$filepath = 'sales-report-newcomer-products/';
    $yeardir = $filepath . date('Y/', $log_date);
    if (!file_exists(DIR_FS_ARCHIVES . $yeardir) || !is_dir(DIR_FS_ARCHIVES . $yeardir)) {
        mkdir(DIR_FS_ARCHIVES . $yeardir);
    }
    $monthdir = $yeardir . date('m/', $log_date);
    if (!file_exists(DIR_FS_ARCHIVES . $monthdir) || !is_dir(DIR_FS_ARCHIVES . $monthdir)) {
        mkdir(DIR_FS_ARCHIVES . $monthdir);
    }
    $path_location = DIR_FS_ARCHIVES . $monthdir;
    $filename = date('YmdHi', strtotime($timestamp)) . '-sales-report-newcomer-products-' . $sp_detail['package_prefix'] . '.pdf';
    $pdf->Output($path_location . $filename, 'F');
    $logger->write("PDF CREATED: {$filename}");
    //$pdf->Output($filename, 'D');
    return true;
}
$n_pdf_created = 0;
//Generate JG reports
if (generateReports($timestamp, 0)) {
    $n_pdf_created++;
}
//Generate SP reports
foreach ($sps as $jng_sp_id => $sp_dt) {
    if (generateReports($timestamp, $jng_sp_id)) {
        $n_pdf_created++;
    }
}
$logger->write("{$n_pdf_created} pdf files created");
$logger->close();
tep_db_close();
echo "DONE " . date('Y-m-d H:i:s');
Example #2
0
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html>
<head>
<title>Storybot Reports</title>
<link rel="stylesheet" type="text/css" href="media/style.css">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
</head>
<body>
<center>
<a href='index.php'><img src="media/logo.png" /></a>
<h2>Report Log</h2>
<h3>Displays 5 oldest reports. To see new ones, deal with the oldest ones first.</h3>
<?php 
define("IN_STORYBOT", 1);
require_once "config/config.php";
if (!is_admin(mod_id())) {
    die("Administrator rights required!");
}
generateReports();
?>
<hr>
End of page.
</center>
</body>
</html>