Skip to content

Commit

Permalink
Merge branch 'staging' into deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
horcsinbalint committed Jul 13, 2024
2 parents fe40107 + 5456252 commit d33ef7d
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 25 deletions.
2 changes: 1 addition & 1 deletion app/Http/Controllers/Secretariat/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function storeProfilePicture(Request $request, User $user): RedirectRespo
session()->put('section', 'profile_picture');

$request->validate([
'picture' => 'required|mimes:jpg,jpeg,png,gif,svg',
'picture' => 'required|mimes:jpg,jpeg,png,gif',
]);
$path = $request->file('picture')->store('avatars');
$old_profile = $user->profilePicture;
Expand Down
2 changes: 1 addition & 1 deletion app/Utils/CheckoutHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ public function addExpense(Request $request): RedirectResponse
'comment' => 'required|string',
'amount' => 'required|integer|min:0',
'payer' => 'exists:users,id',
'receipt' => 'required|mimes:pdf,jpg,jpeg,png,gif,svg',
'receipt' => 'required|mimes:pdf,jpg,jpeg,png,gif',
]);
$validator->validate();

Expand Down
37 changes: 37 additions & 0 deletions app/Utils/LatexSanitizer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

namespace App\Utils;

class LatexSanitizer
{
/**
* Converts a single character to a \symbol{...} command
* @param string $char
* @return string $string
*/
private static function convertCharToSymbol(string $char): string
{
if($char == ' ') {
return ' ';
}
return "\\symbol{" . mb_ord($char) . "}";
}

/**
* Converts string to a relatively safe Latex code by putting every character into a seperate \symbol{...}
* @param string $data
* @return string|null $string
*/
public static function sanitizeLatex(string|null $data): string
{
if($data == null) {
return "";
}
$len = mb_strlen($data);
$result = [];
for ($i = 0; $i < $len; $i++) {
$result[] = LatexSanitizer::convertCharToSymbol(mb_substr($data, $i, 1));
}
return implode($result);
}
}
2 changes: 1 addition & 1 deletion config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

'name' => env('APP_NAME', 'Urán'),

'version' => '3.24', // update on release
'version' => '3.23.2', // update on release

'logo_blue_path' => env('APP_ENV', "local") != "production" ? '/img/mars.png' : '/img/uran_blue.png',

Expand Down
6 changes: 3 additions & 3 deletions resources/views/latex/import.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

\begin{enumerate}
@foreach($items as $item)
\item {{ $item->name }} @if(isset($item->serial_number)) ({{ $item->serial_number }}) @endif
\item {{ \App\Utils\LatexSanitizer::sanitizeLatex($item->name) }} @if(isset($item->serial_number)) ({{ \App\Utils\LatexSanitizer::sanitizeLatex($item->serial_number) }}) @endif
@endforeach
\end{enumerate}

Expand All @@ -63,11 +63,11 @@
birtokolt programokat és egyéb tartalmakat.

\vspace{2em}
\noindent{}Budapest, {{ $date }}
\noindent{}Budapest, {{ \App\Utils\LatexSanitizer::sanitizeLatex($date) }}

\hfill\lotofdots

\hfill {{ $name }} \hspace{3.5em}
\hfill {{ \App\Utils\LatexSanitizer::sanitizeLatex($name) }} \hspace{3.5em}

\vspace{3em}

Expand Down
14 changes: 7 additions & 7 deletions resources/views/latex/register-statement.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@

\vspace*{2em}

\noindent{}Név: {{ $name }} \\
Állandó lakcím: {{ $address }} \\
Telefonszám: {{ $phone }} \\
E-mail: {{ $email }} \\
Születési hely és idő: {{ $place_and_of_birth }} \\
Anyja neve: {{ $mothers_name }} \\
\noindent{}Név: {{ \App\Utils\LatexSanitizer::sanitizeLatex($name) }} \\
Állandó lakcím: {{ \App\Utils\LatexSanitizer::sanitizeLatex($address) }} \\
Telefonszám: {{ \App\Utils\LatexSanitizer::sanitizeLatex($phone) }} \\
E-mail: {{ \App\Utils\LatexSanitizer::sanitizeLatex($email) }} \\
Születési hely és idő: {{ \App\Utils\LatexSanitizer::sanitizeLatex($place_and_of_birth) }} \\
Anyja neve: {{ \App\Utils\LatexSanitizer::sanitizeLatex($mothers_name) }} \\
Beköltözés dátuma: \\
\\
Megjegyzések:
Expand All @@ -50,7 +50,7 @@
A fentieket tudomásul vettem, a szobát a leltár szerint átvettem.

\vspace{2em}
\noindent{}Budapest, {{ $date }}
\noindent{}Budapest, {{ \App\Utils\LatexSanitizer::sanitizeLatex($date) }}

\hfill\lotofdots

Expand Down
21 changes: 9 additions & 12 deletions resources/views/latex/status-cert.blade.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[magyar]{babel}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{multirow}

\usepackage{caption}
\usepackage[letterspace=300]{microtype}

\usepackage{atbegshi}
\usepackage{tikz}
\usepackage[left=2cm, right=2cm, top=5cm, bottom=1cm]{geometry}
Expand Down Expand Up @@ -45,7 +42,7 @@
}
\textsc{
{\scriptsize
{{ \App\Models\User::director()?->name }}\\
{{ \App\Utils\LatexSanitizer::sanitizeLatex(\App\Models\User::director()?->name) }}\\
igazgató\\
}
}
Expand All @@ -56,7 +53,7 @@
\begin{flushleft}
{\scriptsize H-1118 Budapest, Ménesi út 11-13\\
Tel.: +36 1 460 4481 • Fax.: +36 1 209 2044 \\
E-mail: {{config("mail.secretary_mail")}}{{\App\Models\User::director()?->email }}
E-mail: {{ \App\Utils\LatexSanitizer::sanitizeLatex(config("mail.secretary_mail")) }}{{ \App\Utils\LatexSanitizer::sanitizeLatex(\App\Models\User::director()?->email) }}
% [email protected][email protected]\\
Honlap: https://eotvos.elte.hu/ }
\end{flushleft}
Expand All @@ -79,16 +76,16 @@
\begin{document}
\maketitle

Alulírott {{ \App\Models\User::director()?->name }}, az ELTE Eötvös József Collegium igazgatója, hivatalosan igazolom, hogy {{ $name }} (Neptun-kód: {{ $neptun }}) az ELTE Eötvös József Collegium tagja {{ $from }}. szeptemberétől.
Alulírott {{ \App\Utils\LatexSanitizer::sanitizeLatex(\App\Models\User::director()?->name) }}, az ELTE Eötvös József Collegium igazgatója, hivatalosan igazolom, hogy {{ \App\Utils\LatexSanitizer::sanitizeLatex($name) }} (Neptun-kód: {{ \App\Utils\LatexSanitizer::sanitizeLatex($neptun) }}) az ELTE Eötvös József Collegium tagja {{ \App\Utils\LatexSanitizer::sanitizeLatex($from) }}. szeptemberétől.

A tagság érvényességének befejezése: {{ $until }}
A tagság érvényességének befejezése: {{ \App\Utils\LatexSanitizer::sanitizeLatex($until) }}

Személyes adatai:
\begin{itemize}
\itemsep0em
\item születési helye és ideje: {{ $place_and_date_of_birth }}
\item anyja neve: {{ $mothers_name }}
\item állandó lakcíme: {{ $address }}
\item születési helye és ideje: {{ \App\Utils\LatexSanitizer::sanitizeLatex($place_and_date_of_birth) }}
\item anyja neve: {{ \App\Utils\LatexSanitizer::sanitizeLatex($mothers_name) }}
\item állandó lakcíme: {{ \App\Utils\LatexSanitizer::sanitizeLatex($address) }}
\end{itemize}


Expand All @@ -98,7 +95,7 @@

\begin{flushright}
\begin{minipage}[t]{0.4\textwidth}
\signature{ {{ \App\Models\User::director()?->name }} }{igazgató}{Eötvös József Collegium}
\signature{ {{ \App\Utils\LatexSanitizer::sanitizeLatex(\App\Models\User::director()?->name) }} }{igazgató}{Eötvös József Collegium}
\end{minipage}
\end{flushright}

Expand Down

0 comments on commit d33ef7d

Please sign in to comment.