blob: 1d64e60b4d24961b87035b1e30534406ecd79608 [file] [log] [blame]
<?php
require_once "/home/data/httpd/eclipse-php-classes/system/dbconnection_dashboard_rw.class.php";
require_once "../stats/hostname.php";
$dbc_cache = new DBConnectionDashboard();
$db_handle = $dbc_cache->connect();
function download_log_dashboard($db_handle,$project){
global $columns;
$log_file = "";
if ($project == "")
exit(1); // No empty project name
// Main query to select all stats from dashboard
$query = "SELECT * FROM ".log_table()." WHERE project_id = \"".$project."\"";
$result = mysql_query($query,$db_handle);
$row = mysql_fetch_assoc($result);
$log_file = "NEWS LOG\r\n";
$log_file .= $row['news_text']."\r\n\r\n";
$log_file .= "MAIL LOG\r\n\r\n";
$log_file .= $row['mail_text']."\r\n\r\n";
$log_file .= "BUGS LOG\r\n\r\n";
$log_file .= $row['bugs_text']."\r\n\r\n";
return $log_file;
}
@ob_start();
if (isset($_GET['project'])){
$project = ereg_replace("[^a-zA-Z0-9 ]","",$_GET['project']);
$log_file = download_log_dashboard($db_handle,$project);
$output_file = $project.'_stats.log.txt';
}
@ob_end_clean();
@ini_set('zlib.output_compression', 'Off');
header('Pragma: public');
header('Last-Modified: '.gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: pre-check=0, post-check=0, max-age=0');
header('Content-Transfer-Encoding: none');
// This should work for IE & Opera
//header('Content-Type: application/octetstream; name="' . $output_file . '"');
// This should work for the rest
//header('Content-Type: application/octet-stream; name="' . $output_file . '"');
header('Content-Type: text/plain; name="' . $output_file . '"');
header('Content-Disposition: attachment; filename="' . $output_file . '"');
echo $log_file;
$output_file = null;
$csv_file = null;
$query = null;
$result = null;
$db_handle = null;
$dbc_cache = null;
exit();
?>