$time - $delay) { readfile($htmlPath); exit; } /* Get some data for the current group (centered and/or fixed layout) */ if (file_exists($clickheatConf['logPath'].$group.'/url.txt')) { $f = fopen($clickheatConf['logPath'].$group.'/url.txt', 'r'); $layout = trim(fgets($f, 1024)); fclose($f); } else { $layout = ''; } $layout = explode('>', $layout); if (count($layout) !== 4) { $layout = array('', 0, 0, 0); } /* Call the Heatmap class */ $clicksHeatmap = new HeatmapFromClicks(); $clicksHeatmap->browser = $browser; $clicksHeatmap->minScreen = $minScreen; $clicksHeatmap->maxScreen = $maxScreen; $clicksHeatmap->layout = $layout; $clicksHeatmap->memory = $clickheatConf['memory'] * 1048576; $clicksHeatmap->step = $clickheatConf['step']; $clicksHeatmap->dot = $clickheatConf['dot']; $clicksHeatmap->palette = $clickheatConf['palette']; $clicksHeatmap->heatmap = $heatmap; $clicksHeatmap->path = $clickheatConf['cachePath']; $clicksHeatmap->cache = $clickheatConf['cachePath']; $clicksHeatmap->file = $imagePath.'-%d.png'; /* Add files */ for ($day = 0; $day < $days; $day++) { $currentDate = date('Y-m-d', mktime(0, 0, 0, date('m', $dateStamp), date('d', $dateStamp) + $day, date('Y', $dateStamp))); $clicksHeatmap->addFile($clickheatConf['logPath'].$group.'/'.$currentDate.'.log'); } $result = $clicksHeatmap->generate($width); if ($result === false) { errorGenerate($clicksHeatmap->error); } $html = ''; for ($i = 0; $i < $result['count']; $i++) { $html .= '
'; } echo $html; /* Save the HTML code to speed up following queries (only over two minutes) */ $f = fopen($htmlPath, 'w'); fputs($f, $html); fclose($f); /** * Retourne une erreur / Returns an error * * @param string $error */ function errorGenerate($error) { echo ' 
'.$error.'
'; exit; }