Overview
Comment:Fix [f6e724cc24770a2eaad699bf2777a26d5b9a8d4c] email address appears inverted in some cases
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | stable
Files: files | file ages | folders
SHA3-256: 307d6ee1541ee3a364e1d0b776c747f95880c2e076ded0610dc6116edb7c5b6f
User & Date: bohwaz on 2022-12-09 14:12:57
Other Links: manifest | tags
References
2022-12-09
14:14 Fixed ticket [f6e724cc24]: L'adresse e-mail apparaît à l'envers sur le site web plus 5 other changes artifact: 89145122a3 user: bohwaz
Context
2022-12-09
14:13
Fix last sent in emails, where it failed in some cases check-in: d39cc2cbb7 user: bohwaz tags: trunk, stable
14:12
Fix [f6e724cc24770a2eaad699bf2777a26d5b9a8d4c] email address appears inverted in some cases check-in: 307d6ee154 user: bohwaz tags: trunk, stable
2022-12-07
13:03
Fix appropriation check-in: 72b5cf03ab user: bohwaz tags: trunk, stable
Changes

Modified src/include/lib/Garradin/UserTemplate/Modifiers.php from [19dff20043] to [0105f9fb06].

131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148

149
150
151

152

153
154
155
156
157
158
159
	{
		$str = strip_tags($str);
		$str = self::truncate($str, $length);
		$str = preg_replace("/\n{2,}/", '</p><p>', $str);
		return '<p>' . $str . '</p>';
	}

	static public function protect_contact(?string $contact): string
	{
		if (!trim($contact))
			return '';

		if (strpos($contact, '@')) {
			$reversed = strrev($contact);
			// https://unicode-table.com/en/FF20/
			$reversed = strtr($reversed, ['@' => '@']);

			return sprintf('<a href="#error" onclick="this.href = (this.innerText + \':otliam\').split(\'\').reverse().join(\'\').replace(/@/, \'@\');"><span style="unicode-bidi:bidi-override;direction: rtl;">%s</span></a>',

				htmlspecialchars($reversed));
		}
		else {

			return '<a href="'.htmlspecialchars($contact, ENT_QUOTES, 'UTF-8').'">'.htmlspecialchars($contact, ENT_QUOTES, 'UTF-8').'</a>';

		}
	}

	static public function atom_date($date)
	{
		return Utils::date_fr($date, DATE_ATOM);
	}







|




|
|
|
|

|
>
|


>
|
>







131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
	{
		$str = strip_tags($str);
		$str = self::truncate($str, $length);
		$str = preg_replace("/\n{2,}/", '</p><p>', $str);
		return '<p>' . $str . '</p>';
	}

	static public function protect_contact(?string $contact, ?string $type = null): string
	{
		if (!trim($contact))
			return '';

		if ($type == 'mail' || strpos($contact, '@')) {
			$user = strtok($contact, '@');
			$domain = strtok('.');
			$ext = strtok(false);

			return sprintf('<a href="#error" class="protected-contact" data-a="%s" data-b="%s" data-c="%s"
				onclick="if (this.href.match(/#error/)) this.href = [\'mail\', \'to:\', this.dataset.a, \'@\', this.dataset.b, \'.\' + this.dataset.c].join(\'\');"></a>',
				htmlspecialchars($user), htmlspecialchars($domain), htmlspecialchars($ext));
		}
		else {
			$label = preg_replace_callback('/[a-zA-Z0-9@]/', fn ($match)  => '&#' . ord($match[0]) . ';', htmlspecialchars($contact));
			$url = htmlspecialchars($type ? $type . ':' : '') . $label;
			return sprintf('<a href="%s">%s</a>', $url, $label);
		}
	}

	static public function atom_date($date)
	{
		return Utils::date_fr($date, DATE_ATOM);
	}

Modified src/www/skel-dist/_head.html from [9a857f7940] to [9eeb7fff08].

45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
			{{if $config.files.logo}}
			<h3>{{$config.nom_asso}}</h3>
			{{/if}}
			{{if $config.adresse_asso}}
				<h4>{{$config.adresse_asso|escape|nl2br}}</h4>
			{{/if}}
			{{if $config.telephone_asso}}
				<h5>{{$config.telephone_asso|raw|protect_contact}}</h5>
			{{/if}}
			{{if $config.email_asso}}
				<h5>{{$config.email_asso|raw|protect_contact}}</h5>
			{{/if}}
		</article>
	{{/if}}
</header>







|







45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
			{{if $config.files.logo}}
			<h3>{{$config.nom_asso}}</h3>
			{{/if}}
			{{if $config.adresse_asso}}
				<h4>{{$config.adresse_asso|escape|nl2br}}</h4>
			{{/if}}
			{{if $config.telephone_asso}}
				<h5>{{$config.telephone_asso|raw|protect_contact:'tel'}}</h5>
			{{/if}}
			{{if $config.email_asso}}
				<h5>{{$config.email_asso|raw|protect_contact}}</h5>
			{{/if}}
		</article>
	{{/if}}
</header>

Modified src/www/skel-dist/content.css from [686e986b7d] to [e66d8e7bed].

1
2
3
4
5
6




7
8
9
10
11
12
13
/**
 * Ce fichier contient les styles CSS qui s'appliquent au contenu des articles et catégorie,
 * que ce soit sur le site public ou dans la prévisualisation de l'administration.
 *
 * Généralement il n'est pas nécessaire de le modifier.
 */





.web-content p, .web-content h1, .web-content h2, .web-content h3, .web-content h4, .web-content h5, .web-content h6,
.web-content ul, .web-content ol, .web-content table, .web-content blockquote, .web-content pre {
    margin: 0;
    margin-bottom: .8em;
}







>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/**
 * Ce fichier contient les styles CSS qui s'appliquent au contenu des articles et catégorie,
 * que ce soit sur le site public ou dans la prévisualisation de l'administration.
 *
 * Généralement il n'est pas nécessaire de le modifier.
 */

.protected-contact::before {
    content: attr(data-a) "\0040" attr(data-b) "." attr(data-c);
}

.web-content p, .web-content h1, .web-content h2, .web-content h3, .web-content h4, .web-content h5, .web-content h6,
.web-content ul, .web-content ol, .web-content table, .web-content blockquote, .web-content pre {
    margin: 0;
    margin-bottom: .8em;
}