Ejemplo n.º 1
0
if (empty($extension_exclusions)) {
    $extension_exclusions = array();
}
if (empty($hash_array)) {
    $hash_array = array("crc32b", "md5", "sha1", "sha256");
}
$output = "\"Path\",\"FileName\",\"Size\"";
foreach ($hash_array as $hash_type) {
    $output .= ",\"" . $hash_type . "\"";
}
$output .= "\n";
if (is_file($path)) {
    $hash_output = "";
    foreach ($hash_array as $hash_type) {
        $hash_output .= ",\"" . hash_file($hash_type, $path) . "\"";
    }
    $output .= "\"" . dirname($path) . "\",\"" . basename($path) . "\",\"" . filesize($path) . "\"" . $hash_output . "\n";
} else {
    if (is_dir($path)) {
        $output .= dircrawl($path, $hash_array, $extension_exclusions);
    } else {
        print "\n" . $path . " is not an existing Path or Filename\n";
        printusage();
    }
}
if (isset($output_file)) {
    file_put_contents($output_file, $output);
    print "\nOutput Written to " . $output_file . "\n";
} else {
    print $output . "\n";
}
Ejemplo n.º 2
0
            break;
        default:
            if ($infile == '') {
                $infile = $args[$i];
            } else {
                $outfile = $args[$i];
            }
            break;
    }
}
if ($infile == '') {
    printusage('No input file specified.');
}
if ($outfile == '') {
    if ($infile != 'php://stdin') {
        $outfile = $infile . '.pdf';
    } else {
        printusage('No output file specified.');
    }
}
# Check to see if the output file exists
if (file_exists($outfile)) {
    # If it exists, check to see if we are to overwrite it.
    if ($force) {
        unlink($outfile);
    } else {
        printusage('Output file already exists.  Use -f to overwrite.');
    }
}
touch($outfile);
emailtotiff::processemail($emailfile, $outfile, $coverfile);
Ejemplo n.º 3
0
             $totalpages = $args[$i + 1];
             $i++;
             break;
         case '-pdf':
             $topdf = true;
             break;
         case '-':
             $filelist[] = '-';
             break;
         default:
             $filelist[] = $args[$i];
             break;
     }
 }
 if ($destemail === '') {
     printusage('No destination email specified.');
 }
 if ($fromemail === '') {
     $fromemail .= 'fax@' . php_uname('n');
 }
 if ($fromname === '') {
     $fromname = 'Fax System';
 }
 if ($emailsubject === '') {
     $emailsubject = 'Fax Received from ' . $remoteident . ' (' . $remotecidname . '/' . $remotecidnum . ')';
 }
 if ($emailbody !== '') {
     if (strstr('<', $emailbody)) {
         $emailhtml = $emailbody;
         $emailbody = strip_tags(str_replace(array('<br>', '</p>', '<br/>', '<br />'), "/n", $emailbody));
     } else {
Ejemplo n.º 4
0
                }
                break;
            default:
                if ($infile === '') {
                    $infile = $args[$i];
                } else {
                    $outfile = $args[$i];
                }
                break;
        }
    }
    if ($infile === '') {
        printusage('No input file specified.');
    }
    if ($outfile === '') {
        printusage('No output file specified.');
    }
    $intfileres = fopen($infile, 'rb');
    $outfileres = fopen($outfile, 'ab');
    while (!feof($intfileres)) {
        fwrite($outfileres, fread($intfileres, 8192));
    }
    fclose($intfileres);
    fclose($outfileres);
    # Remove the original file
    unlink($infile);
    exit;
} catch (Exception $e) {
    mail($systememail, 'Error moving file', $e->getMessage());
    exit(1);
}
Ejemplo n.º 5
0
             $i++;
             break;
         case '-s':
             $systememail = $args[$i + 1];
             $i++;
             break;
         case '-':
             $infile = 'php://stdin';
             break;
         default:
             $infile = $args[$i];
             break;
     }
 }
 if ($infile == '') {
     printusage('No input file specified.');
 }
 # Since we can only read STDIN once, we need to read the email into a temporary file for processing
 # Generate an intermediate file name for the pdf file
 $intmpname = (string) abs((int) (microtime(true) * 100000));
 # Create a temporary file name for the pdf and tiff file
 $emailfile = sys_get_temp_dir() . '/' . $intmpname . '.tmp';
 $tifffile = $faxstoragedir . '/' . $intmpname . '.tiff';
 # Write the intermediate file to the final destination
 $intfileres = fopen($infile, 'rb');
 $outfileres = fopen($emailfile, 'ab');
 while (!feof($intfileres)) {
     fwrite($outfileres, fread($intfileres, 8192));
 }
 fclose($intfileres);
 fclose($outfileres);