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);
61 aws_updateLink($site, $dir);
65 function aws_updateLink($site, $targetdir)
67 $curdir = $GLOBALS['htmldir'] . '/' . $site . '/current';
69 symlink($targetdir, $curdir);
72 function aws_createIndex($site)
74 $dirs = glob($GLOBALS['htmldir'] . '/' . $site . '/*', GLOB_ONLYDIR);
77 foreach ($dirs as $dir) {
78 $name = basename($dir);
79 $links .= '<li><a href="' . $name . '/awstats.' . $site . '.html">'
80 . $name . '</a></li>';
83 <?xml version="1.0" encoding="utf-8"?>
86 <title>{$site}</title>
96 $GLOBALS['htmldir'] . '/' . $site . '/index.htm',
101 function aws_createGlobalIndex()
103 $dirs = glob($GLOBALS['htmldir'] . '/*', GLOB_ONLYDIR);
106 foreach ($dirs as $dir) {
107 $name = basename($dir);
109 . '<a href="' . $name . '/">' . $name . '</a>'
110 . ' <a href="' . $name . '/current/awstats.' . $name . '.html">[current]</a>'
114 <?xml version="1.0" encoding="utf-8"?>
117 <title>awstats</title>
127 $GLOBALS['htmldir'] . '/index.htm',