From ad15580c03fc4b9713f99324e36a4a6f5f784496 Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Mon, 23 Jan 2012 09:56:48 -0500
Subject: [PATCH] Fixed: FS#1992 - Error path apache2 vhost.

---
 server/conf/awstats_index.php.master |   29 +++++++++++++++++++----------
 1 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/server/conf/awstats_index.php.master b/server/conf/awstats_index.php.master
index 90cf909..1cb20a6 100644
--- a/server/conf/awstats_index.php.master
+++ b/server/conf/awstats_index.php.master
@@ -8,7 +8,7 @@
 
 <?php
 $aw['aw_jump_text'] = 'Jump to previous stats: ';
-$aw['aw_renamed_index'] = 'fixedindex.html';
+$aw['aw_renamed_index'] = 'awsindex.html';
 
 if ($handle = opendir('.'))
 {
@@ -16,36 +16,45 @@
         {
                 if (substr($file,0,1) != "." && is_dir($file))
                 {
-                        $awprev[] = $file;
+                        $orderkey = substr($file,0,4).substr($file,5,2);
+                        if (substr($file,5,2) < 10 )
+                        {
+                                $orderkey = substr($file,0,4)."0".substr($file,5,2);
+                        }
+                        $awprev[$orderkey] = $file;
                 }
         }
 
         $month = date("n");
         $year = date("Y");
-
+		
         if (date("d") == 1)
         {
-                $awmonth = date("m")-1;
+                $month = date("m")-1;
                 if (date("m") == 1)
                 {
-                        $awyear = date("Y")-1;
-                        $awmonth = "12";
+                        $year = date("Y")-1;
+                        $month = "12";
                 }
         }
 
-        $awprev[] = $year."-".$month;
+        $current = $year.$month;
+		if ( $month < 10 ) {
+			$current = $year."0".$month;
+		}
+		$awprev[$current] = $year."-".$month;
 
-        closedir($handle);
+		closedir($handle);
 }
 
 echo '<div style="width: 97%; margin-left: 4px; height: 20px; background-color: #FFFFFF; position: fixed; padding: 7px; border: 2px solid #cccccc;><div align="left"><font color="#000000" size="2" face="Verdana, Arial, Helvetica,  sans-serif">' .$aw["aw_jump_text"]. '</font </div>';
 
 echo "<select name='awdate' onchange=\"load_content(this.value)\">";
-rsort($awprev);
+krsort($awprev);
 
 foreach ($awprev as $key => $value)
 {
-        if($key == 0)
+        if($key == $current)
         {
                 echo "<option selected=\"selected\" value=\"".$aw['aw_renamed_index']."\"> $value</option>";
         }

--
Gitblit v1.9.1