compile_check = true; //$smarty->debugging = true; $smarty->template_dir = "./templates"; $smarty->compile_dir = "./templates_c"; $smarty->config_dir = "./configs"; $smarty->config_load("bacula.conf"); // Load config file $mode = $smarty->get_config_vars("mode"); // Lite o Extend? require("lang.php"); // generaldata.tpl & last_run_report.tpl (last24bytes) $client = $dbSql->link->query("select count(*) from Client") or die ("Error query at row 37"); $totalfiles = $dbSql->link->query("select count(FilenameId) from Filename") or die ("Error query at row 39"); $last24bytes = $dbSql->link->query("select sum(JobBytes),count(*) from Job where Endtime <= NOW() and UNIX_TIMESTAMP(EndTime) > UNIX_TIMESTAMP(NOW())-86400") or die ("Error query at row 41"); $bytes_stored =& $dbSql->link->getOne("select SUM(VolBytes) from Media") or die ("Error query at row 43"); $smarty->assign('bytes_stored',$bytes_stored); $tmp = $client->fetchRow(); $smarty->assign('clientes_totales',$tmp[0]); $tmp = $last24bytes->fetchRow(); if ( empty($tmp[0]) ) { // No data for last 24, search last 48 $last24bytes = $dbSql->link->query("select sum(JobBytes) from Job where Endtime <= NOW() and UNIX_TIMESTAMP(EndTime) > UNIX_TIMESTAMP(NOW())-172800" ); $smarty->assign('when',"yesterday"); } $smarty->assign('bytes_totales',$tmp[0]); $smarty->assign('total_jobs', $tmp[1]); $tmp = $totalfiles->fetchRow(); $smarty->assign('files_totales',$tmp[0]); $client->free(); $totalfiles->free(); $last24bytes->free(); // report_select.tpl & last_run_report.tpl $res = $dbSql->link->query("select Name from Job group by Name"); $a_jobs = array(); while ( $tmp = $res->fetchRow() ) array_push($a_jobs, $tmp[0]); $smarty->assign('total_name_jobs',$a_jobs); $smarty->assign('time2',( (time())-2678400) ); // Current time - 1 month.