7 foreach (glob($GLOBALS['confdir'] . '/awstats.*.conf') as $file) {
8 $sites[] = preg_replace('/^.*awstats.(.+).conf$/', '\\1', $file);
13 function aws_createHtml($site, $last = false)
15 if (!is_dir($GLOBALS['htmldir'])) {
16 die("HTML directory " . $GLOBALS['htmldir'] . " does not exist\n");
20 $month = date('m', strtotime('last month'));
21 $year = date('Y', strtotime('last month'));
27 $dir = $GLOBALS['htmldir'] . '/' . $site . '/' . $year . '-' . $month . '/';
29 mkdir($dir, 0777, true);
31 $cmd = $GLOBALS['awsbstp']
32 . ' -config=' . escapeshellarg($site)
33 . ' -awstatsprog=' . escapeshellarg($GLOBALS['awstats'])
37 . ' -dir=' . escapeshellarg($dir);
41 aws_updateLink($site, $dir);
45 function aws_updateLink($site, $targetdir)
47 $curdir = $GLOBALS['htmldir'] . '/' . $site . '/current';
49 symlink($targetdir, $curdir);
52 function aws_createIndex($site)
54 $dirs = glob($GLOBALS['htmldir'] . '/' . $site . '/*', GLOB_ONLYDIR);
57 foreach ($dirs as $dir) {
58 $name = basename($dir);
59 $links .= '<li><a href="' . $name . '/awstats.' . $site . '.html">'
60 . $name . '</a></li>';
63 <?xml version="1.0" encoding="utf-8"?>
66 <title>{$site}</title>
76 $GLOBALS['htmldir'] . '/' . $site . '/index.htm',
81 function aws_createGlobalIndex()
83 $dirs = glob($GLOBALS['htmldir'] . '/*', GLOB_ONLYDIR);
86 foreach ($dirs as $dir) {
87 $name = basename($dir);
88 $links .= '<li><a href="' . $name . '/">'
89 . $name . '</a></li>';
92 <?xml version="1.0" encoding="utf-8"?>
95 <title>awstats</title>
105 $GLOBALS['htmldir'] . '/index.htm',