diff --git a/inc/8chan-mod-pages.php b/inc/8chan-mod-pages.php index 176baf39..1854a77d 100644 --- a/inc/8chan-mod-pages.php +++ b/inc/8chan-mod-pages.php @@ -521,24 +521,21 @@ EOT; preg_match_all("#$match_urls#im", $clean_css, $matched); $allowed_urls = array('https://i.imgur.com/', 'https://media.8chan.co/', 'https://a.pomf.se/', 'https://fonts.googleapis.com/', 'https://fonts.gstatic.com/', 'http://8ch.net/', 'https://8chan.co/'); - $error = false; if (isset($matched[0])) { - foreach ($matched[0] as $i => $v) { - $error = true; - foreach ($allowed_urls as $ii => $url) { - if (strpos($v, $url) === 0) { - $error = false; - break; + foreach ($matched[0] as $match) { + $match_okay = false; + foreach ($allowed_urls as $allowed_url) { + if (strpos($match, $allowed_url) !== false) { + $match_okay = true; } } + if ($match_okay !== true) { + error(sprintf(_("Off-site link \"%s\" is not allowed!"), $match)); + } } } - if ($error) { - error(_('Off-site links are not allowed in board stylesheets!')); - } - $query = query('SELECT `uri`, `title`, `subtitle` FROM ``boards`` WHERE `8archive` = TRUE'); file_write('8archive.json', json_encode($query->fetchAll(PDO::FETCH_ASSOC))); file_write($b.'/config.php', $config_file);