+/* Read encrypted file. */
+if ($link['crypted'])
+{
+ /* Extract key and iv. */
+ $ex = explode (".", $crypt_key);
+ $key = $ex[0];
+ $iv = base64_decode($ex[1]);
+ error_log ("crypt_key: " . $crypt_key . " iv: " . $v . " key: ". $key . "\n", 3, "debug.log");
+ /* Init module */
+ $m = mcrypt_module_open('rijndael-256', '', 'ofb', '');
+ mcrypt_generic_init($m, $key, $iv);
+ /* Decrypt file. */
+ $r = fopen (VAR_FILES . $p . $link['md5'], 'r');
+ while (!feof ($r))
+ {
+ $dec = mdecrypt_generic($m, fread ($r, 1024));
+ print $dec;
+ ob_flush();
+ }
+ fclose ($r);
+ /* Cleanup. */
+ mcrypt_generic_deinit($m);
+ mcrypt_module_close($m);
+}
+/* Read file. */
+else