#407 View Unsafe Images Whitelist

closed
nobody
5
2005-04-11
2003-10-31
Thomas Zavaleta
No

Would like to have a whitelist of from addresses that will
assume inline images are safe skipping the need to
click 'view unsafe images' everytime. I HACKED this into
mine (v1.4.2)...

in src/read_body.php at line 778 added an include:
include('safe_image_whitelist.php');

This is right above the loop that calls formatBody()

The included file contains this: (once again this is a hack
to make as minimal modifications as necessary (i
shouldn't be editting $_GET directly)...

//safe_image_whitelist.php
// Safe Image Whitelist
// Thomas Zavaleta
// This will check and see if the from is "safe" then show
the
// images not require specific selection of images from
sender
// uses whitelist.txt
$fileWhiteList = "whitelist.txt";

$theader = $message->rfc822_header;
$tfrom_name = $theader->getAddr_s('from');
$whitelist = explode(" ", file_get_contents
($fileWhiteList));
if (is_array($whitelist)) {
foreach($whitelist as $item) {
if (strpos($tfrom_name, trim($item)) !== false) {
$_GET['view_unsafe_images'] = 1;
break;
}
}
}

function file_get_contents($filename, $use_include_path
= 0) {
$data = "";
$file = @fopen($filename, "rb", $use_include_path);
if ($file) {
while (!feof($file)) $data .= fread($file, 1024);
fclose($file);
}
return $data;
}
?>

Then i just have the whitelist.txt file (sample) items
seperated by spaces:

endofauction@ebay.com savedsearches@ebay.com

Discussion

    • summary: View Unsame Images Whitelist --> View Unsafe Images Whitelist
     
  • Jimmy Conner
    Jimmy Conner
    2004-08-21

    Logged In: YES
    user_id=385245

    There is the view_unsafe_images plugin that already contains
    this functionality.

    This should probably be closed.

     
    • status: open --> closed