Overview
Comment:Fix links in admin homepage
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | stable | 1.1.1
Files: files | file ages | folders
SHA3-256: 1395906311abcff3b37c04ed513210ea709a2473ff341890f427ad9a32fb398b
User & Date: bohwaz on 2021-04-10 11:39:09
Other Links: manifest | tags
Context
2021-04-10
11:49
Don't enforce quota in upgrade check-in: afdce7b8c0 user: bohwaz tags: trunk, stable, 1.1.1
11:39
Fix links in admin homepage check-in: 1395906311 user: bohwaz tags: trunk, stable, 1.1.1
11:19
Fix reset when nothing is selected check-in: a5af1bd78b user: bohwaz tags: trunk, stable
Changes

Modified src/VERSION from [05e17b646a] to [7d07f23865].

1
1.1.0
|
1
1.1.1

Modified src/include/lib/Garradin/Upgrade.php from [e75e1a1335] to [0a9d699f0f].

190
191
192
193
194
195
196































197
198
199
200
201
202
203
				if ($bg) {
					$file = Files::get($bg);

					if (!$file) {
						$db->exec('UPDATE config SET value = NULL WHERE key = \'admin_background\';');
					}
				}































			}

			// Vérification de la cohérence des clés étrangères
			$db->foreignKeyCheck();

			// Delete local cached files
			Utils::resetCache(USER_TEMPLATES_CACHE_ROOT);







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
				if ($bg) {
					$file = Files::get($bg);

					if (!$file) {
						$db->exec('UPDATE config SET value = NULL WHERE key = \'admin_background\';');
					}
				}

				// Fix links of admin homepage
				$homepage = $db->firstColumn('SELECT value FROM config WHERE key = \'admin_homepage\';');

				if ($homepage) {
					$file = Files::get($homepage);

					if ($file) {
						$content = $file->fetch();
						$new_content = preg_replace_callback(';\[\[((?!\]\]).*)\]\];', function ($match) {
							$link = explode('|', $match[1]);
							if (count($link) == 2) {
								list($label, $link) = $link;
							}
							else {
								$label = $link = $link[0];
							}

							if (strpos(trim($link), '/') !== false) {
								return $match[0];
							}

							$link = sprintf('!web/page.php?p=%s', trim($link));
							return sprintf('[[%s|%s]]', $label, $link);
						}, $content);

						if ($new_content != $content) {
							$file->setContent($new_content);
						}
					}
				}
			}

			// Vérification de la cohérence des clés étrangères
			$db->foreignKeyCheck();

			// Delete local cached files
			Utils::resetCache(USER_TEMPLATES_CACHE_ROOT);

Modified src/include/lib/Garradin/Web/Render/Skriv.php from [b88f52b63d] to [c909ffc27e].

38
39
40
41
42
43
44
45
46

47
48
49
50
51
52
53
		// "bla/Image.jpg" in web context or absolute link, eg. "/transactions/2442/42.jpg"
		else {
			return WWW_URL . '/' . ltrim($uri, '/');
		}
	}

	static public function resolveLink(string $uri) {
		if (substr($uri, 0, 1) == '/') {
			return WWW_URL . ltrim($uri, '/');

		}

		if (strpos(Utils::basename($uri), '.') === false) {
			$uri .= self::$link_suffix;
		}

		return self::$link_prefix . $uri;







|
|
>







38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
		// "bla/Image.jpg" in web context or absolute link, eg. "/transactions/2442/42.jpg"
		else {
			return WWW_URL . '/' . ltrim($uri, '/');
		}
	}

	static public function resolveLink(string $uri) {
		$first = substr($uri, 0, 1);
		if ($first == '/' || $first == '!') {
			return Utils::getLocalURL($uri);
		}

		if (strpos(Utils::basename($uri), '.') === false) {
			$uri .= self::$link_suffix;
		}

		return self::$link_prefix . $uri;