Skip to content

Commit

Permalink
checkup: delete images containing cloudcrap scripts
Browse files Browse the repository at this point in the history
<script src="/_Incapsula_Resource?...>
  • Loading branch information
tpruvot committed Jun 9, 2018
1 parent eee06c9 commit 035d304
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion web/yaamp/commands/CheckupCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,15 @@ public function autolinkCoinsImages()
$nbUpdated = 0; $nbDropped = 0;
foreach ($coins->findAll() as $coin) {
if (!empty($coin->image)) {
if (file_exists($this->basePath.$coin->image))
if (file_exists($this->basePath.$coin->image)) {
$data = file_get_contents($this->basePath.$coin->image);
if (strstr($data, "<script ")) {
unlink($this->basePath.$coin->image);
$coin->image = NULL;
$nbDropped += $coin->save();
}
continue;
}
if (file_exists($this->basePath."/images/coin-$coin->symbol.png")) {
$coin->image = "/images/coin-$coin->symbol.png";
$nbUpdated += $coin->save();
Expand Down

0 comments on commit 035d304

Please sign in to comment.