Exemplo n.º 1
0
function write_sxw($tmpdir, $contents, $filename)
{
    global $CONF, $DB;
    // write modified document
    $fd = fopen($tmpdir . '/content.xml', 'w');
    fwrite($fd, $contents);
    fclose($fd);
    zip_file($tmpdir, $filename);
    exec("rm -rf '{$tmpdir}'");
}
Exemplo n.º 2
0
//download_data("http://talkingpointsmemo.com/images/","bernanke-askance-large.jpg","");
download_data($webDirectory, $precinctsFile, $localDirectory);
download_data($webDirectory, $locationsFile, $localDirectory);
download_data($webDirectory, $segmentsFile, $localDirectory);
//Add contents to feed.
$contents = addHeader($dateArray);
fwrite($xmlHandle, $contents);
$contents = addPrecincts(file_get_contents($localDirectory . $precinctsFile));
fwrite($xmlHandle, $contents);
$contents = addLocations(file_get_contents($localDirectory . $locationsFile));
fwrite($xmlHandle, $contents);
$contents = addSegments(file_get_contents($localDirectory . $segmentsFile), $xmlHandle);
fwrite($xmlHandle, $contents);
$contents = addFooter();
fwrite($xmlHandle, $contents);
zip_file($fname, $fnameZip);
if ($autoFTPupload) {
    post_file($ftp_directory . $fnameZipND, $fnameZip, $ftp_server, $ftp_user, $ftp_pass);
}
addLogMessage("DONE!");
//Close handles
fclose($logHandle);
fclose($xmlHandle);
/**
 * Download the data. Put in local directory
 * See decriptions of inputs above 
 */
function download_data($webDirectory, $dataFileName, $localDirectory)
{
    addLogMessage("Start download of " . $dataFileName);
    if (!@copy($webDirectory . $dataFileName, $localDirectory . $dataFileName)) {