7 foreach (glob($GLOBALS['confdir'] . '/awstats.*.conf') as $file) {
8 $sites[] = preg_replace('/^.*awstats.(.+).conf$/', '\\1', $file);
13 function aws_historic($site)
16 foreach (glob($GLOBALS['awdata'] . '/awstats*.' . $site . '.txt') as $file) {
20 '/^.*\/awstats([0-9]{2})([0-9]{4})\\.' . $site . '.txt$/',
25 count($date) == 2 && $dates[] = $date;
30 function aws_createHtml($site, $last = false, $year = null, $month = null)
32 if (!is_dir($GLOBALS['htmldir'])) {
33 die("HTML directory " . $GLOBALS['htmldir'] . " does not exist\n");
36 if ($year !== null && $month !== null) {
39 $month = date('m', strtotime('last month'));
40 $year = date('Y', strtotime('last month'));
46 $dir = $GLOBALS['htmldir'] . '/' . $site . '/' . $year . '-' . $month . '/';
48 mkdir($dir, 0777, true);
50 $cmd = $GLOBALS['awsbstp']
51 . ' -config=' . escapeshellarg($site)
52 . ' -awstatsprog=' . escapeshellarg($GLOBALS['awstats'])
56 . ' -dir=' . escapeshellarg($dir);
60 aws_updateLink($site, $dir);
64 function aws_updateLink($site, $targetdir)
66 $curdir = $GLOBALS['htmldir'] . '/' . $site . '/current';
68 symlink($targetdir, $curdir);
71 function aws_createIndex($site)
73 $dirs = glob($GLOBALS['htmldir'] . '/' . $site . '/*', GLOB_ONLYDIR);
76 foreach ($dirs as $dir) {
77 $name = basename($dir);
78 $links .= '<li><a href="' . $name . '/awstats.' . $site . '.html">'
79 . $name . '</a></li>';
82 <?xml version="1.0" encoding="utf-8"?>
85 <title>{$site}</title>
95 $GLOBALS['htmldir'] . '/' . $site . '/index.htm',
100 function aws_createGlobalIndex()
102 $dirs = glob($GLOBALS['htmldir'] . '/*', GLOB_ONLYDIR);
105 foreach ($dirs as $dir) {
106 $name = basename($dir);
107 $links .= '<li><a href="' . $name . '/">'
108 . $name . '</a></li>';
111 <?xml version="1.0" encoding="utf-8"?>
114 <title>awstats</title>
124 $GLOBALS['htmldir'] . '/index.htm',