Commit a2224d85 authored by Malcolm Blaney's avatar Malcolm Blaney

Switch regex matching in Detail->User.

parent ba65ad71
Pipeline #17701105 passed with stage
in 1 minute and 30 seconds
......@@ -681,7 +681,15 @@ class Detail extends Base {
if ($result = $mysqli->query($query)) {
if ($detail = $result->fetch_assoc()) {
$img = '<img class="thumb u-photo" src="/images/default_thumb.jpg">';
if (preg_match('/^(.+)\.(.+)$/', $detail['thumbnail'], $match)) {
// Support the SimplePie image cache too.
$base_url = $this->user->config->Secure() ? 'https://' : 'http://';
$base_url .= $this->user->config->ServerName();
$regex = '/^' . preg_quote($base_url . '/php/image.php?i=', '/') .
'[[:xdigit:]]+$/';
if (preg_match($regex, $detail['thumbnail'])) {
$img = '<img class="thumb u-photo" src="' . $detail['thumbnail'].'">';
}
else if (preg_match('/^(.+)\.(.+)$/', $detail['thumbnail'], $match)) {
$name = $match[1];
$type = $match[2];
if (in_array($type, ['gif', 'jpeg', 'jpg', 'png'])) {
......@@ -689,17 +697,6 @@ class Detail extends Base {
$img = '<img class="thumb u-photo" src="' . $name . '">';
}
}
else {
// Support the SimplePie image cache too.
$base_url = $this->user->config->Secure() ? 'https://' : 'http://';
$base_url .= $this->user->config->ServerName();
$regex = '/^' . preg_quote($base_url . '/php/image.php?i=', '/') .
'[[:xdigit:]]+$/';
if (preg_match($regex, $detail['thumbnail'])) {
$img =
'<img class="thumb u-photo" src="' . $detail['thumbnail'] . '">';
}
}
$email = htmlspecialchars($detail['email']);
$first = $detail['first'];
$last = $detail['last'];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment