[SCM] BOINC packaging branch, SZTAKI, updated. debian/6.10.17+dfsg-3-276-g235a1d6

Steffen Moeller moeller at debian.org
Sat Jun 11 22:50:02 UTC 2011


The following commit has been merged in the SZTAKI branch:
commit 235a1d642aebe03f04c19ef43640acb4eee7e5bd
Author: Steffen Moeller <moeller at debian.org>
Date:   Sun Jun 12 00:49:22 2011 +0200

    Removed html/szdg-stat from patches.

diff --git a/SZTAKI_patches_remaining_to_move_into_debian.patch b/SZTAKI_patches_remaining_to_move_into_debian.patch
index 7d8ea05..313c433 100644
--- a/SZTAKI_patches_remaining_to_move_into_debian.patch
+++ b/SZTAKI_patches_remaining_to_move_into_debian.patch
@@ -3212,2234 +3212,6 @@
      $geoip_country = geoip_country_name_by_addr($gi,$_SERVER["REMOTE_ADDR"]);
      geoip_close($gi);
  
---- boinc-server-6.11.0+r18946.orig/html/szdg-stat/stat_performance.php
-+++ boinc-server-6.11.0+r18946/html/szdg-stat/stat_performance.php
-@@ -0,0 +1,39 @@
-+#! /usr/bin/env php
-+<?php
-+/*
-+ * stat_performance.php
-+ * by Marosi Attila Csaba <atisu at sztaki dot hu>
-+ * March 26, 2006
-+ *
-+ * This is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU Lesser General Public
-+ * License as published by the Free Software Foundation;
-+ * either version 2.1 of the License, or (at your option) any later version.
-+ *
-+ * This software is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-+ * See the GNU Lesser General Public License for more details.
-+ *
-+ * To view the GNU Lesser General Public License visit
-+ * http://www.gnu.org/copyleft/lesser.html
-+ * or write to the Free Software Foundation, Inc.,
-+ * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-+ *
-+ *
-+ */
-+
-+ require_once 'include/stat.inc.php';
-+
-+ $sQuery = "SELECT SUM(h.p_fpops * r.cpu_time) / 172800 ".
-+    "FROM result r LEFT JOIN host h ON r.hostid = h.id ".
-+    "WHERE received_time > UNIX_TIMESTAMP()-172800";
-+ $sFileName = "performance48.txt";
-+
-+ // ----- do the magic
-+ $iData = round( getData($sQuery) * 1E-9, 3);
-+ insertData(STAT_TABLE_PERF, $iData);
-+ createTextOut($sFileName, $iData);
-+
-+?>
-+
---- boinc-server-6.11.0+r18946.orig/html/szdg-stat/rrd_host.php
-+++ boinc-server-6.11.0+r18946/html/szdg-stat/rrd_host.php
-@@ -0,0 +1,117 @@
-+#! /usr/bin/env php
-+<?php
-+/*
-+ * rrd_host.php
-+ * by Marosi Attila Csaba <atisu at sztaki dot hu>
-+ * December 11, 2008
-+ *
-+ * This is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU Lesser General Public
-+ * License as published by the Free Software Foundation;
-+ * either version 2.1 of the License, or (at your option) any later version.
-+ *
-+ * This software is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-+ * See the GNU Lesser General Public License for more details.
-+ *
-+ * To view the GNU Lesser General Public License visit
-+ * http://www.gnu.org/copyleft/lesser.html
-+ * or write to the Free Software Foundation, Inc.,
-+ * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-+ *
-+ *
-+ */
-+require_once 'include/class/sqlfunc.class.php';
-+require_once 'include/class/displayhosts.class.php';
-+include_once 'include/utilities.inc.php';
-+include_once 'include/rrd_utils.inc.php';
-+include_once 'rrd_config.inc';
-+
-+// upper limit of the y-axis;
-+$iUpperLimit = 50;
-+// count host only with activity NOW()-$iActivityPeriod
-+$iActivityPeriod = 3600*24*7;
-+$iTime = round(time(), -1);
-+// select only those host that were active in the last week
-+$sQuery= "SELECT
-+	    expavg_credit,
-+	    host.id AS hostid,
-+	    domain_name,
-+	    last_ip_addr AS ip,
-+	    SUM( IF(server_state=4, 1, 0)) AS rcount
-+	  FROM host
-+	  LEFT JOIN result ON
-+	    host.id=result.hostid
-+	  WHERE
-+	    rpc_time > UNIX_TIMESTAMP(NOW())-". $iActivityPeriod. "
-+	  GROUP BY host.host_cpid";
-+$sQueryActivity = "SELECT
-+		     domain_name,
-+		     host.id as hostid,
-+		     last_ip_addr as ip,
-+		     MAX(rpc_time)
-+		   FROM host
-+		   WHERE
-+		     rpc_time > UNIX_TIMESTAMP(NOW())-". $iActivityPeriod. "
-+		   GROUP BY host_cpid";
-+
-+$oSqlFunc = new SqlFunc();
-+$oSqlFunc->connectDb();
-+
-+if ($argv[1] == "graph") {
-+    $aResults = $oSqlFunc->fetchArrayResults($sQueryActivity);
-+    writeLog("removing old graphs");
-+    execRrd("rm -rf ". $sImageDir. "1week_host_*.png");
-+    execrrd("rm -rf ". $sImageDir. "31days_host_*.png");
-+
-+    $oDHWeek = new DisplayHosts($aClasses);
-+    $oDHMonth = new DisplayHosts($aClasses);
-+
-+} else {
-+    $aResults = $oSqlFunc->fetchArrayResults($sQuery);
-+}
-+
-+if (is_array($aResults)) {
-+    foreach($aResults as $aResult) {
-+	$sFilename = "host_". str_pad($aResult['hostid'], 6, "0", PAD_RIGHT);
-+	$sRrdPath = $sRrdDir. $sFilename. ".rrd";
-+	if (!is_file($sRrdPath)) {
-+	    writeLog( "creating RRD (". $sRrdPath. ")");
-+	    // feed interval: 1800 sec, heartbeat: 4500 sec, number of rows: 4464
-+	    execRrd("rrdtool create ". $sRrdPath. " --start ". $iTime. " --step 1800 DS:date:GAUGE:4500:U:U DS:expavgcredit:GAUGE:4500:U:U RRA:AVERAGE:0.5:1:4464");
-+	} else {
-+	    // either generate graph or update data
-+	    if ($argv[1] == "graph") {
-+
-+		// 1 week diagrams
-+		$sImagePath = $sImageDir. "1week_". $sFilename. ".png";
-+		writeLog("creating graph (". $sImagePath. ")");
-+		execRrd("rrdtool graph --start now-604800 --end now -u ". $iUpperLimit. " -t \"". $aResult['domain_name']. " // ".
-+			$aResult['ip']. " - last 1 week\" ". $sImagePath. " DEF:timestamp=". $sRrdPath. ":date:AVERAGE DEF:expavgcredit=". $sRrdPath. ":expavgcredit:AVERAGE ".
-+			" LINE2:timestamp#FF0000:\"Number of work units on the client\" LINE2:expavgcredit#0000FF:\"Granted credit per second for the client, recent average\"");
-+		$oDHWeek->add($aResult['ip'], "1week_". $sFilename. ".png", $aResult);
-+
-+		// 1 month diagrams
-+		$sImagePath = $sImageDir. "31days_". $sFilename. ".png";
-+		writeLog("creating graph (". $sImagePath. ")");
-+		execRrd("rrdtool graph --start now-2678400 --end now -u ". $iUpperLimit. " -t \"". $aResult['domain_name']. " // ".
-+		      $aResult['ip']. " - last 31 days\" ". $sImagePath. " DEF:timestamp=". $sRrdPath. ":date:AVERAGE DEF:expavgcredit=". $sRrdPath. ":expavgcredit:AVERAGE ".
-+			" LINE2:timestamp#FF0000:\"Number of work units on the client\" LINE2:expavgcredit#0000FF:\"Granted credit per second for the client, recent average\"");
-+		$oDHMonth->add($aResult['ip'],  "31days_". $sFilename. ".png", $aResult);
-+
-+	    } else {
-+		writeLog("updating RRD (". $sRrdPath. ")");
-+		execRrd("rrdtool update ". $sRrdPath. " ". $iTime. ":". $aResult['rcount']. ":". $aResult['expavg_credit']);
-+	    }
-+	}
-+    }
-+    if ($argv[1] == "graph") {
-+      $oDHMonth->printPage($sImageDir. "show_hosts_31days.html");
-+      $oDHWeek->printPage($sImageDir. "show_hosts_1week.html");
-+      $oDHWeek->printPageCredit($sImageDir. "credit_stats.html");
-+    }
-+}
-+
-+
-+writeLog("done updating");
---- boinc-server-6.11.0+r18946.orig/html/szdg-stat/stat_wu_inprogress.php
-+++ boinc-server-6.11.0+r18946/html/szdg-stat/stat_wu_inprogress.php
-@@ -0,0 +1,33 @@
-+#! /usr/bin/env php
-+<?php
-+/*
-+ * stat_wu_inprogress.php
-+ * by Marosi Attila Csaba <atisu at sztaki dot hu>
-+ * March 21, 2006
-+ *
-+ * This is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU Lesser General Public
-+ * License as published by the Free Software Foundation;
-+ * either version 2.1 of the License, or (at your option) any later version.
-+ *
-+ * This software is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-+ * See the GNU Lesser General Public License for more details.
-+ *
-+ * To view the GNU Lesser General Public License visit
-+ * http://www.gnu.org/copyleft/lesser.html
-+ * or write to the Free Software Foundation, Inc.,
-+ * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-+ *
-+ *
-+ */
-+
-+ require_once 'include/stat.inc.php';
-+
-+ $sQuery="SELECT COUNT(*) FROM result WHERE server_state=4";
-+
-+ // ----- do the magic
-+ $iData=getData($sQuery);
-+ insertData(STAT_TABLE_WU_INPROG, $iData);
-+?>
---- boinc-server-6.11.0+r18946.orig/html/szdg-stat/stat_wu_unsent.php
-+++ boinc-server-6.11.0+r18946/html/szdg-stat/stat_wu_unsent.php
-@@ -0,0 +1,35 @@
-+#! /usr/bin/env php
-+<?php
-+/*
-+ * stat_wu_unsent.php
-+ * by Marosi Attila Csaba <atisu at sztaki dot hu>
-+ * March 21, 2006
-+ *
-+ * This is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU Lesser General Public
-+ * License as published by the Free Software Foundation;
-+ * either version 2.1 of the License, or (at your option) any later version.
-+ *
-+ * This software is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-+ * See the GNU Lesser General Public License for more details.
-+ *
-+ * To view the GNU Lesser General Public License visit
-+ * http://www.gnu.org/copyleft/lesser.html
-+ * or write to the Free Software Foundation, Inc.,
-+ * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-+ *
-+ *
-+ */
-+
-+ require_once 'include/stat.inc.php';
-+
-+ $sQuery="SELECT COUNT(*) FROM result WHERE server_state=2";
-+ $sFileName="wu_unsent.txt";
-+
-+ // ----- do the magic
-+ $iData=getData($sQuery);
-+ insertData(STAT_TABLE_WU_UNSENT, $iData);
-+ createTextOut($sFileName, $iData);
-+?>
---- boinc-server-6.11.0+r18946.orig/html/szdg-stat/stat_hosts.php
-+++ boinc-server-6.11.0+r18946/html/szdg-stat/stat_hosts.php
-@@ -0,0 +1,35 @@
-+#! /usr/bin/env php
-+<?php
-+/*
-+ * stat_hosts.php
-+ * by Marosi Attila Csaba <atisu at sztaki dot hu>
-+ * June 14, 2006
-+ *
-+ * This is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU Lesser General Public
-+ * License as published by the Free Software Foundation;
-+ * either version 2.1 of the License, or (at your option) any later version.
-+ *
-+ * This software is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-+ * See the GNU Lesser General Public License for more details.
-+ *
-+ * To view the GNU Lesser General Public License visit
-+ * http://www.gnu.org/copyleft/lesser.html
-+ * or write to the Free Software Foundation, Inc.,
-+ * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-+ *
-+ *
-+ */
-+
-+ require_once 'include/stat.inc.php';
-+
-+ $sQuery="SELECT COUNT(*) FROM host where total_credit >= 0.001";
-+ $sFileName="hosts.txt";
-+
-+ // ----- do the magic
-+ $iData=getData($sQuery);
-+ insertData(STAT_TABLE_HOSTS, $iData);
-+ createTextOut($sFileName, $iData);
-+?>
---- boinc-server-6.11.0+r18946.orig/html/szdg-stat/chart_hosts.php
-+++ boinc-server-6.11.0+r18946/html/szdg-stat/chart_hosts.php
-@@ -0,0 +1,52 @@
-+#! /usr/bin/env php
-+<?php
-+/*
-+ * chart_hosts.php
-+ * by Marosi Attila Csaba <atisu at sztaki dot hu>
-+ * March 26, 2006
-+ *
-+ * This is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU Lesser General Public
-+ * License as published by the Free Software Foundation;
-+ * either version 2.1 of the License, or (at your option) any later version.
-+ *
-+ * This software is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-+ * See the GNU Lesser General Public License for more details.
-+ *
-+ * To view the GNU Lesser General Public License visit
-+ * http://www.gnu.org/copyleft/lesser.html
-+ * or write to the Free Software Foundation, Inc.,
-+ * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-+ *
-+ *
-+ */
-+
-+ require_once 'include/config.inc.php';
-+ require_once 'include/class/chart.class.php';
-+ require_once 'include/utilities.inc.php';
-+ require_once 'include/class/stat.class.php';
-+
-+ // common stuff
-+ $cStat=new Stat(STAT_TABLE_HOSTS);
-+ //$cStat->setDbParams(STAT_DB_HOST, STAT_DB_USER, STAT_DB_PW, STAT_DB_NAME);
-+ $cStat->setShouldDebug(FALSE);
-+ $cChart=new Chart(900, 300);
-+ $cChart->iXTextPosAdjust=-25;
-+ $cChart->sYPosition='right';
-+ $cChart->sPrintYValue='normal';
-+
-+ // number of hosts for the last 28 days -->
-+ //  common
-+ $aItems=$cStat->getLastItemsAfterNowMinus(3600*24*28);
-+ if (!($cChart->iYTextFilter=round(count($aItems)/10)))
-+	$cChart->iYTextFilter=1;
-+ foreach ($aItems as $aItem)
-+	$cChart->aItems[]=array(x=>$aItem['date'], y=>round($aItem['value'],1));
-+ $cChart->sYName='Hosts';
-+ $cChart->writeToFile(SZDGSTAT_OUTPUT_DIR . '/hosts28day.jpg');
-+ // <--
-+
-+ $cChart->destroy();
-+?>
---- boinc-server-6.11.0+r18946.orig/html/szdg-stat/stat_wu_total.php
-+++ boinc-server-6.11.0+r18946/html/szdg-stat/stat_wu_total.php
-@@ -0,0 +1,33 @@
-+#! /usr/bin/env php
-+<?php
-+/*
-+ * stat_wu_total.php
-+ * by Marosi Attila Csaba <atisu at sztaki dot hu>
-+ * March 21, 2006
-+ *
-+ * This is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU Lesser General Public
-+ * License as published by the Free Software Foundation;
-+ * either version 2.1 of the License, or (at your option) any later version.
-+ *
-+ * This software is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-+ * See the GNU Lesser General Public License for more details.
-+ *
-+ * To view the GNU Lesser General Public License visit
-+ * http://www.gnu.org/copyleft/lesser.html
-+ * or write to the Free Software Foundation, Inc.,
-+ * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-+ *
-+ *
-+ */
-+
-+ require_once 'include/stat.inc.php';
-+
-+ $sQuery="SELECT COUNT(*) FROM result";
-+
-+ // ----- do the magic
-+ $iData=getData($sQuery);
-+ insertData(STAT_TABLE_WU_TOTAL, $iData);
-+?>
---- boinc-server-6.11.0+r18946.orig/html/szdg-stat/chart_wu_total.php
-+++ boinc-server-6.11.0+r18946/html/szdg-stat/chart_wu_total.php
-@@ -0,0 +1,52 @@
-+#! /usr/bin/env php
-+<?php
-+/*
-+ * chart_wu_total.php
-+ * by Marosi Attila Csaba <atisu at sztaki dot hu>
-+ * June 14, 2006
-+ *
-+ * This is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU Lesser General Public
-+ * License as published by the Free Software Foundation;
-+ * either version 2.1 of the License, or (at your option) any later version.
-+ *
-+ * This software is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-+ * See the GNU Lesser General Public License for more details.
-+ *
-+ * To view the GNU Lesser General Public License visit
-+ * http://www.gnu.org/copyleft/lesser.html
-+ * or write to the Free Software Foundation, Inc.,
-+ * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-+ *
-+ *
-+ */
-+
-+ require_once 'include/config.inc.php';
-+ require_once 'include/class/chart.class.php';
-+ require_once 'include/utilities.inc.php';
-+ require_once 'include/class/stat.class.php';
-+
-+ // common stuff
-+ $cStat=new Stat(STAT_TABLE_WU_TOTAL);
-+ //$cStat->setDbParams(STAT_DB_HOST, STAT_DB_USER, STAT_DB_PW, STAT_DB_NAME);
-+ $cStat->setShouldDebug(FALSE);
-+ $cChart=new Chart(900, 300);
-+ $cChart->iXTextPosAdjust=-25;
-+ $cChart->sYPosition='right';
-+ $cChart->sPrintYValue='normal';
-+
-+ // number of total wus for the last 14 days -->
-+ //  common
-+ $aItems=$cStat->getLastItemsAfterNowMinus(3600*24*14);
-+ if (!($cChart->iYTextFilter=round(count($aItems)/10)))
-+	$cChart->iYTextFilter=1;
-+ foreach ($aItems as $aItem)
-+	$cChart->aItems[]=array(x=>$aItem['date'], y=>round($aItem['value'],1));
-+ $cChart->sYName='Workunits';
-+ $cChart->writeToFile(SZDGSTAT_OUTPUT_DIR . '/wu_total14day.jpg');
-+ // <--
-+
-+ $cChart->destroy();
-+?>
---- boinc-server-6.11.0+r18946.orig/html/szdg-stat/rrd_result.php
-+++ boinc-server-6.11.0+r18946/html/szdg-stat/rrd_result.php
-@@ -0,0 +1,69 @@
-+#! /usr/bin/env php
-+<?php
-+/*
-+ * rrd_result.php
-+ * by Marosi Attila Csaba <atisu at sztaki dot hu>
-+ * December 11, 2008
-+ *
-+ * This is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU Lesser General Public
-+ * License as published by the Free Software Foundation;
-+ * either version 2.1 of the License, or (at your option) any later version.
-+ *
-+ * This software is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-+ * See the GNU Lesser General Public License for more details.
-+ *
-+ * To view the GNU Lesser General Public License visit
-+ * http://www.gnu.org/copyleft/lesser.html
-+ * or write to the Free Software Foundation, Inc.,
-+ * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-+ *
-+ *
-+ */
-+
-+require_once 'include/class/sqlfunc.class.php';
-+include_once 'include/utilities.inc.php';
-+include_once 'include/rrd_utils.inc.php';
-+
-+$iTime = round(time(), -1);
-+$oSqlFunc = new SqlFunc();
-+$oSqlFunc->connectDb();
-+// Inprogress results
-+$sQueryInprogress = "select count(*) from result where server_state=4";
-+$aResult = $oSqlFunc->fetchRow($sQueryInprogress);
-+$iInprogress = $aResult[0];
-+// Inprogress and unsent results
-+$sQueryNotFinished = "select count(*) from result where server_state=4 or server_state=2";
-+$aResult = $oSqlFunc->fetchRow($sQueryNotFinished);
-+$iNotFinished = $aResult[0];
-+
-+$sFilename = "results.rrd";
-+$sRrdPath = $sRrdDir. $sFilename;
-+if (!is_file($sRrdPath)) {
-+    writeLog( "creating RRD (". $sRrdPath. ")");
-+    // feed interval: 1800 sec, heartbeat: 4500 sec, number of rows: 4464
-+    execRrd("rrdtool create ". $sRrdPath. " --start ". $iTime. " --step 1800 DS:inprogress:GAUGE:4500:U:U DS:notfinished:GAUGE:4500:U:U RRA:AVERAGE:0.5:1:4464");
-+} else {
-+    // either generate graph or update data
-+    if ($argv[1] != "graph") {
-+	writeLog("updating RRD (". $sRrdPath. ")");
-+	execRrd("rrdtool update ". $sRrdPath. " ". $iTime. ":". $iInprogress. ":". $iNotFinished);
-+    } else {
-+	writelog("creating graph (". $sImagePath. ")");
-+	$sImagePath = $sImageDir. "1week_results.png";
-+	execRrd("rrdtool graph --start now-604800 --end now --width 900 --height 250 -t \"Total number of work units and number of being processed work units - last 1 week\" ".
-+		$sImagePath. " DEF:inprogress=". $sRrdPath. ":inprogress:AVERAGE DEF:notfinished=".
-+		$sRrdPath. ":notfinished:AVERAGE LINE2:notfinished#FF0000:\"Number of work units on the server\" ".
-+		"LINE2:inprogress#0000FF:\"Number of work units on the server being processed\"");
-+	$sImagePath = $sImageDir. "31days_results.png";
-+	execRrd("rrdtool graph --start now-2678400 --end now --width 900 --height 250 -t \"Total number of work units and number of being processed work units - last 31 days\" ".
-+		$sImagePath. " DEF:inprogress=". $sRrdPath. ":inprogress:AVERAGE DEF:notfinished=".
-+		$sRrdPath. ":notfinished:AVERAGE LINE2:notfinished#FF0000:\"Number of work units on the server\" ".
-+		"LINE2:inprogress#0000FF:\"Number of work units on the server being processed\"");
-+    }
-+}
-+
-+writeLog("done updating");
-+
---- boinc-server-6.11.0+r18946.orig/html/szdg-stat/chart_performance.php
-+++ boinc-server-6.11.0+r18946/html/szdg-stat/chart_performance.php
-@@ -0,0 +1,74 @@
-+#! /usr/bin/env php
-+<?php
-+/*
-+ * chart_performance.php
-+ * by Marosi Attila Csaba <atisu at sztaki dot hu>
-+ * March 26, 2006
-+ *
-+ * This is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU Lesser General Public
-+ * License as published by the Free Software Foundation;
-+ * either version 2.1 of the License, or (at your option) any later version.
-+ *
-+ * This software is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-+ * See the GNU Lesser General Public License for more details.
-+ *
-+ * To view the GNU Lesser General Public License visit
-+ * http://www.gnu.org/copyleft/lesser.html
-+ * or write to the Free Software Foundation, Inc.,
-+ * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-+ *
-+ *
-+ */
-+
-+ require_once 'include/config.inc.php';
-+ require_once 'include/class/chart.class.php';
-+ require_once 'include/utilities.inc.php';
-+ require_once 'include/class/stat.class.php';
-+
-+ // common stuff
-+ $cStat=new Stat(STAT_TABLE_PERF);
-+ //$cStat->setDbParams(STAT_DB_HOST, STAT_DB_USER, STAT_DB_PW, STAT_DB_NAME);
-+ $cStat->setShouldDebug(FALSE);
-+ $cChart=new Chart(900, 300);
-+ $cChart->sYName='GFLOP/s';
-+ $cChart->iXTextPosAdjust=-25;
-+ $cChart->sYPosition='right';
-+ $cChart->sPrintYValue='normal';
-+
-+ // performance for the last 28 days -->
-+ //  common
-+ $aItems=$cStat->getLastItemsAfterNowMinus(3600*24*28);
-+ if (!($cChart->iYTextFilter=round(count($aItems)/10)))
-+	$cChart->iYTextFilter=1;
-+ foreach ($aItems as $aItem)
-+	$cChart->aItems[]=array(x=>$aItem['date'], y=>round($aItem['value'],1));
-+ $cChart->writeToFile(SZDGSTAT_OUTPUT_DIR . '/performance28day.jpg');
-+ // <--
-+
-+ // performance for the last 48 hours
-+ //  common
-+ $cChart->reset();
-+ $aItems=$cStat->getLastItemsAfterNowMinus(3600*48);
-+ if (!($cChart->iYTextFilter=round(count($aItems)/10)))
-+	$cChart->iYTextFilter=1;
-+ foreach ($aItems as $aItem)
-+	$cChart->aItems[]=array(x=>$aItem['date'], y=>round($aItem['value'],1));
-+ $cChart->writeToFile(SZDGSTAT_OUTPUT_DIR . '/performance48.jpg');
-+ // <--
-+
-+ // performance for the last 168 hours
-+ //  common
-+ $cChart->reset();
-+ $aItems=$cStat->getLastItemsAfterNowMinus(3600*168);
-+ if (!($cChart->iYTextFilter=round(count($aItems)/10)))
-+	$cChart->iYTextFilter=1;
-+ foreach ($aItems as $aItem)
-+	$cChart->aItems[]=array(x=>$aItem['date'], y=>round($aItem['value'],1));
-+ $cChart->writeToFile(SZDGSTAT_OUTPUT_DIR . '/performance168.jpg');
-+ // <--
-+
-+ $cChart->destroy();
-+?>
---- boinc-server-6.11.0+r18946.orig/html/szdg-stat/stat_users.php
-+++ boinc-server-6.11.0+r18946/html/szdg-stat/stat_users.php
-@@ -0,0 +1,38 @@
-+#! /usr/bin/env php
-+<?php
-+/*
-+ * stat_users.php
-+ * by Marosi Attila Csaba <atisu at sztaki dot hu>
-+ * March 21, 2006
-+ *
-+ * This is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU Lesser General Public
-+ * License as published by the Free Software Foundation;
-+ * either version 2.1 of the License, or (at your option) any later version.
-+ *
-+ * This software is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-+ * See the GNU Lesser General Public License for more details.
-+ *
-+ * To view the GNU Lesser General Public License visit
-+ * http://www.gnu.org/copyleft/lesser.html
-+ * or write to the Free Software Foundation, Inc.,
-+ * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-+ *
-+ *
-+ */
-+
-+ require_once 'include/stat.inc.php';
-+
-+ $sQuery="SELECT COUNT(*) FROM user";
-+ $sFileName="users.txt";
-+
-+ // ----- do the magic
-+ $iData=getData($sQuery);
-+ insertData(STAT_TABLE_USERS, $iData);
-+ createTextOut($sFileName, $iData);
-+
-+?>
-+
-+
---- boinc-server-6.11.0+r18946.orig/html/szdg-stat/chart_wu_inprogress.php
-+++ boinc-server-6.11.0+r18946/html/szdg-stat/chart_wu_inprogress.php
-@@ -0,0 +1,52 @@
-+#! /usr/bin/env php
-+<?php
-+/*
-+ * chart_wu_inprogress.php
-+ * by Marosi Attila Csaba <atisu at sztaki dot hu>
-+ * June 14, 2006
-+ *
-+ * This is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU Lesser General Public
-+ * License as published by the Free Software Foundation;
-+ * either version 2.1 of the License, or (at your option) any later version.
-+ *
-+ * This software is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-+ * See the GNU Lesser General Public License for more details.
-+ *
-+ * To view the GNU Lesser General Public License visit
-+ * http://www.gnu.org/copyleft/lesser.html
-+ * or write to the Free Software Foundation, Inc.,
-+ * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-+ *
-+ *
-+ */
-+
-+ require_once 'include/config.inc.php';
-+ require_once 'include/class/chart.class.php';
-+ require_once 'include/utilities.inc.php';
-+ require_once 'include/class/stat.class.php';
-+
-+ // common stuff
-+ $cStat=new Stat(STAT_TABLE_WU_INPROG);
-+ //$cStat->setDbParams(STAT_DB_HOST, STAT_DB_USER, STAT_DB_PW, STAT_DB_NAME);
-+ $cStat->setShouldDebug(FALSE);
-+ $cChart=new Chart(900, 300);
-+ $cChart->iXTextPosAdjust=-25;
-+ $cChart->sYPosition='right';
-+ $cChart->sPrintYValue='normal';
-+
-+ // number of unsent wus for the last 14 days -->
-+ //  common
-+ $aItems=$cStat->getLastItemsAfterNowMinus(3600*24*14);
-+ if (!($cChart->iYTextFilter=round(count($aItems)/10)))
-+	$cChart->iYTextFilter=1;
-+ foreach ($aItems as $aItem)
-+	$cChart->aItems[]=array(x=>$aItem['date'], y=>round($aItem['value'],1));
-+ $cChart->sYName='Workunits';
-+ $cChart->writeToFile(SZDGSTAT_OUTPUT_DIR . '/wu_inprogress14day.jpg');
-+ // <--
-+
-+ $cChart->destroy();
-+?>
---- boinc-server-6.11.0+r18946.orig/html/szdg-stat/chart_workers.php
-+++ boinc-server-6.11.0+r18946/html/szdg-stat/chart_workers.php
-@@ -0,0 +1,69 @@
-+#! /usr/bin/env php
-+<?php
-+/*
-+ * chart_performance.php
-+ * by Marosi Attila Csaba <atisu at sztaki dot hu>
-+ * Aug 23, 2005
-+ *
-+ * modifing or using without written permission is prohibited.
-+ *
-+ */
-+
-+ require_once 'include/config.inc';
-+ require_once 'include/class/chart.class.php';
-+ require_once 'include/utilities.inc';
-+ require_once 'include/class/sqlfunc.class.php';
-+ require_once 'include/class/stat.class.php';
-+
-+ $sPicOutputFile = SZDGSTAT_OUTPUT_DIR . '/workers24.jpg';
-+ $iChartWidth = 900;
-+ $iChartHeight = 300;
-+ $sTableName = "szdg_stat_workers";
-+ $iItemCount = 24;
-+ $sYName = "db";
-+ $iXTextPosAdjust = -25;
-+ $sYPosition = 'right';
-+ // maxmin / normal
-+ $sPrintYValue = "normal";
-+
-+ $cStat = new Stat($sTableName);
-+ $cStat->setShouldDebug(FALSE);
-+ $cChart = new Chart($iChartWidth, $iChartHeight);
-+ $cChart->sYName = $sYName;
-+ $cChart->iXTextPosAdjust= $iXTextPosAdjust;
-+ $cChart->sYPosition = $sYPosition;
-+ $cChart->sPrintYValue = $sPrintYValue;
-+ $aItems = $cStat->getLastItems($iItemCount);
-+ $aItems = array_reverse($aItems);
-+ $iCount = round(count($aItems) / 10);
-+ if ($iCount == 0 )
-+	$iCount++;
-+ $cChart->iYTextFilter = $iCount;
-+ $iTCounter = 0;
-+ foreach ($aItems as $aItem) {
-+	$iY = $aItem['value'];
-+	unset($iXH);
-+	if ($iTCounter+1 != count($aItems) )  {
-+		$iXH[] = date("Md", $aItem['date']);
-+		$iXH[] = date("H:i", $aItem['date']);
-+	} else {
-+		$iXH[] = " most";
-+	}
-+	$cChart->aItems[] = array(x => $iXH, y => $iY);
-+	$iTCounter++;
-+ }
-+ ob_start();
-+ $cChart->Init();
-+ //header("Content-type: image/jpeg");
-+ //header("Content-transfer-Encoding: binary");
-+ $cChart->Dump();
-+ $sJpeg = ob_get_contents();
-+ ob_end_clean();
-+ if  (!($oHandle = fopen($sPicOutputFile, "w+")) ) {
-+	echo "could not open ". $sPicOutputFile. " for writing";
-+ } else {
-+	fwrite($oHandle, $sJpeg);
-+	fclose($oHandle);
-+ }
-+ $cChart->Done();
-+?>
---- boinc-server-6.11.0+r18946.orig/html/szdg-stat/chart_wu_unsent.php
-+++ boinc-server-6.11.0+r18946/html/szdg-stat/chart_wu_unsent.php
-@@ -0,0 +1,52 @@
-+#! /usr/bin/env php
-+<?php
-+/*
-+ * chart_wu_unsent.php
-+ * by Marosi Attila Csaba <atisu at sztaki dot hu>
-+ * June 14, 2006
-+ *
-+ * This is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU Lesser General Public
-+ * License as published by the Free Software Foundation;
-+ * either version 2.1 of the License, or (at your option) any later version.
-+ *
-+ * This software is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-+ * See the GNU Lesser General Public License for more details.
-+ *
-+ * To view the GNU Lesser General Public License visit
-+ * http://www.gnu.org/copyleft/lesser.html
-+ * or write to the Free Software Foundation, Inc.,
-+ * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-+ *
-+ *
-+ */
-+
-+ require_once 'include/config.inc.php';
-+ require_once 'include/class/chart.class.php';
-+ require_once 'include/utilities.inc.php';
-+ require_once 'include/class/stat.class.php';
-+
-+ // common stuff
-+ $cStat=new Stat(STAT_TABLE_WU_UNSENT);
-+ //$cStat->setDbParams(STAT_DB_HOST, STAT_DB_USER, STAT_DB_PW, STAT_DB_NAME);
-+ $cStat->setShouldDebug(FALSE);
-+ $cChart=new Chart(900, 300);
-+ $cChart->iXTextPosAdjust=-25;
-+ $cChart->sYPosition='right';
-+ $cChart->sPrintYValue='normal';
-+
-+ // number of unsent wus for the last 14 days -->
-+ //  common
-+ $aItems=$cStat->getLastItemsAfterNowMinus(3600*24*14);
-+ if (!($cChart->iYTextFilter=round(count($aItems)/10)))
-+	$cChart->iYTextFilter=1;
-+ foreach ($aItems as $aItem)
-+	$cChart->aItems[]=array(x=>$aItem['date'], y=>round($aItem['value'],1));
-+ $cChart->sYName='Workunits';
-+ $cChart->writeToFile(SZDGSTAT_OUTPUT_DIR . '/wu_unsent14day.jpg');
-+ // <--
-+
-+ $cChart->destroy();
-+?>
---- boinc-server-6.11.0+r18946.orig/html/szdg-stat/chart_users.php
-+++ boinc-server-6.11.0+r18946/html/szdg-stat/chart_users.php
-@@ -0,0 +1,52 @@
-+#! /usr/bin/env php
-+<?php
-+/*
-+ * chart_users.php
-+ * by Marosi Attila Csaba <atisu at sztaki dot hu>
-+ * March 26, 2006
-+ *
-+ * This is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU Lesser General Public
-+ * License as published by the Free Software Foundation;
-+ * either version 2.1 of the License, or (at your option) any later version.
-+ *
-+ * This software is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-+ * See the GNU Lesser General Public License for more details.
-+ *
-+ * To view the GNU Lesser General Public License visit
-+ * http://www.gnu.org/copyleft/lesser.html
-+ * or write to the Free Software Foundation, Inc.,
-+ * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-+ *
-+ *
-+ */
-+
-+ require_once 'include/config.inc.php';
-+ require_once 'include/class/chart.class.php';
-+ require_once 'include/utilities.inc.php';
-+ require_once 'include/class/stat.class.php';
-+
-+ // common stuff
-+ $cStat=new Stat(STAT_TABLE_USERS);
-+ //$cStat->setDbParams(STAT_DB_HOST, STAT_DB_USER, STAT_DB_PW, STAT_DB_NAME);
-+ $cStat->setShouldDebug(FALSE);
-+ $cChart=new Chart(900, 300);
-+ $cChart->iXTextPosAdjust=-25;
-+ $cChart->sYPosition='right';
-+ $cChart->sPrintYValue='normal';
-+
-+ // number of users for the last 28 days -->
-+ //  common
-+ $aItems=$cStat->getLastItemsAfterNowMinus(3600*24*28);
-+ if (!($cChart->iYTextFilter=round(count($aItems)/10)))
-+	$cChart->iYTextFilter=1;
-+ foreach ($aItems as $aItem)
-+	$cChart->aItems[]=array(x=>$aItem['date'], y=>round($aItem['value'],1));
-+ $cChart->sYName='Users';
-+ $cChart->writeToFile(SZDGSTAT_OUTPUT_DIR . '/users28day.jpg');
-+ // <--
-+
-+ $cChart->destroy();
-+?>
---- boinc-server-6.11.0+r18946.orig/html/szdg-stat/sample_rrd_config.inc
-+++ boinc-server-6.11.0+r18946/html/szdg-stat/sample_rrd_config.inc
-@@ -0,0 +1,15 @@
-+<?php
-+
-+global $aClasses;
-+
-+$aClasses = Array();
-+/*
-+// examples:
-+$aClasses["SZTAKI"] = Array("192.168.144.0/24",
-+			"192.168.132.0/24",
-+			"192.168.237.129/32",
-+			"192.168.218.128/32",
-+			"127.0.0.1/32");
-+$aClasses["AMRI"] = Array("10.104.10.0/24");
-+*/
-+?>
---- boinc-server-6.11.0+r18946.orig/html/szdg-stat/include/rrd_utils.inc.php
-+++ boinc-server-6.11.0+r18946/html/szdg-stat/include/rrd_utils.inc.php
-@@ -0,0 +1,44 @@
-+<?php
-+/*
-+ * rrd_utils.inc.php
-+ * by Marosi Attila Csaba <atisu at su dot co dot hu>
-+ * December 11, 2008
-+ *
-+ * This is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU Lesser General Public
-+ * License as published by the Free Software Foundation;
-+ * either version 2.1 of the License, or (at your option) any later version.
-+ *
-+ * This software is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-+ * See the GNU Lesser General Public License for more details.
-+ *
-+ * To view the GNU Lesser General Public License visit
-+ * http://www.gnu.org/copyleft/lesser.html
-+ * or write to the Free Software Foundation, Inc.,
-+ * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-+ *
-+ */
-+
-+$sRrdDir = "rrd/";
-+$sImageDir = "../ops/stats/";
-+
-+
-+function writeLog($sMsg) {
-+    echo date("c"). ": ". $sMsg. "\n";
-+}
-+
-+function execRrd($sCmd) {
-+    //writeLog($sCmd);
-+    return system($sCmd);
-+}
-+
-+
-+function my_ip2long($sIp) {
-+  if (is_numeric($sIp))
-+    return sprintf("%u", floatval($sIp));
-+  return sprintf("%u", floatval(ip2long($sIp)));
-+}
-+
-+?>
---- boinc-server-6.11.0+r18946.orig/html/szdg-stat/include/utilities.inc.php
-+++ boinc-server-6.11.0+r18946/html/szdg-stat/include/utilities.inc.php
-@@ -0,0 +1,82 @@
-+<?php
-+/*
-+ * utilities.inc.php
-+ * by Marosi Attila Csaba <atisu at su dot co dot hu>
-+ * March 20, 2006
-+ *
-+ * This is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU Lesser General Public
-+ * License as published by the Free Software Foundation;
-+ * either version 2.1 of the License, or (at your option) any later version.
-+ *
-+ * This software is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-+ * See the GNU Lesser General Public License for more details.
-+ *
-+ * To view the GNU Lesser General Public License visit
-+ * http://www.gnu.org/copyleft/lesser.html
-+ * or write to the Free Software Foundation, Inc.,
-+ * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-+ *
-+ */
-+
-+function getTimestamp() {
-+	return date("YmdHis");
-+}
-+
-+function getHttpVar($sVar) {
-+	if(!empty($_REQUEST[$sVar])) {
-+	return $_REQUEST[$sVar];
-+    } else {
-+	return null;
-+    }
-+}
-+
-+//converts between 1..29 ( i know it's shit )
-+function decToRoman( $iNumber) {
-+	$aRomanNumbers[1]='I';
-+	$aRomanNumbers[2]='II';
-+	$aRomanNumbers[3]='III';
-+	$aRomanNumbers[4]='IV';
-+	$aRomanNumbers[5]='V';
-+	$aRomanNumbers[6]='VI';
-+	$aRomanNumbers[7]='VII';
-+	$aRomanNumbers[8]='VIII';
-+	$aRomanNumbers[9]='IX';
-+	$aRomanNumbers[10]='X';
-+	$aRomanNumbers[11]='XI';
-+	$aRomanNumbers[12]='XII';
-+	$aRomanNumbers[13]='XIII';
-+	$aRomanNumbers[14]='XIV';
-+	$aRomanNumbers[15]='XV';
-+	$aRomanNumbers[16]='XVI';
-+	$aRomanNumbers[17]='XVII';
-+	$aRomanNumbers[18]='XVIII';
-+	$aRomanNumbers[19]='XIX';
-+	$aRomanNumbers[20]='XX';
-+	$aRomanNumbers[21]='XXI';
-+	$aRomanNumbers[22]='XXII';
-+	$aRomanNumbers[23]='XXIII';
-+	$aRomanNumbers[24]='XXIV';
-+	$aRomanNumbers[25]='XXV';
-+	$aRomanNumbers[26]='XXVI';
-+	$aRomanNumbers[27]='XXVII';
-+	$aRomanNumbers[28]='XXVIII';
-+	$aRomanNumbers[29]='XXIX';
-+	if ($iNumber>0)
-+		return $aRomanNumbers[$iNumber];
-+	else
-+		return -1;
-+}
-+
-+function isWeekend($iTimestamp) {
-+	$iDayOfWeek=date('w', $iTimestamp);
-+	// is it sunday or saturday ?
-+	if (($iDayOfWeek==0) || ($iDayOfWeek==6) )
-+		return true;
-+	else
-+		return false;
-+}
-+
-+?>
---- boinc-server-6.11.0+r18946.orig/html/szdg-stat/include/config.inc.php
-+++ boinc-server-6.11.0+r18946/html/szdg-stat/include/config.inc.php
-@@ -0,0 +1,34 @@
-+<?php
-+/*
-+ * config.inc.php
-+ * by Marosi Attila Csaba <atisu at sztaki hu>
-+ * March 26, 2006
-+ *
-+ * This is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU Lesser General Public
-+ * License as published by the Free Software Foundation;
-+ * either version 2.1 of the License, or (at your option) any later version.
-+ *
-+ * This software is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-+ * See the GNU Lesser General Public License for more details.
-+ *
-+ * To view the GNU Lesser General Public License visit
-+ * http://www.gnu.org/copyleft/lesser.html
-+ * or write to the Free Software Foundation, Inc.,
-+ * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-+ *
-+ */
-+
-+define('SZDGSTAT_OUTPUT_DIR', '../user/performance');
-+
-+// table names for the different collected statistics
-+define('STAT_TABLE_PERF', 'szdg_stat_performance');
-+define('STAT_TABLE_USERS', 'szdg_stat_numofusers');
-+define('STAT_TABLE_HOSTS', 'szdg_stat_numofhosts');
-+define('STAT_TABLE_WU_INPROG', 'szdg_stat_wuinprog');
-+define('STAT_TABLE_WU_TOTAL', 'szdg_stat_wutotal');
-+define('STAT_TABLE_WU_UNSENT', 'szdg_stat_wuunsent');
-+
-+?>
---- boinc-server-6.11.0+r18946.orig/html/szdg-stat/include/strfunc.inc.php
-+++ boinc-server-6.11.0+r18946/html/szdg-stat/include/strfunc.inc.php
-@@ -0,0 +1,120 @@
-+<?php
-+/*
-+ *
-+ * strfunc.inc.php
-+ * by attila csaba marosi <atisu at su dot co dot hu>
-+ * 20050823
-+ *
-+ * This is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU Lesser General Public
-+ * License as published by the Free Software Foundation;
-+ * either version 2.1 of the License, or (at your option) any later version.
-+ *
-+ * This software is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-+ * See the GNU Lesser General Public License for more details.
-+ *
-+ * To view the GNU Lesser General Public License visit
-+ * http://www.gnu.org/copyleft/lesser.html
-+ * or write to the Free Software Foundation, Inc.,
-+ * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-+ *
-+ */
-+
-+if ( !defined("REP_NOT_AMPER") )
-+  define("REP_NOT_AMPER",   1);
-+if ( !defined("REP_NOT_LT") )
-+  define("REP_NOT_LT",      2);
-+if ( !defined("REP_NOT_GT") )
-+  define("REP_NOT_GT",      4);
-+if ( !defined("REP_NOT_BRACKET") )
-+  define("REP_NOT_BRACKET", 8);
-+// --> ...
-+if ( !defined("REP_NOT_QUOT") )
-+  define("REP_NOT_QUOT",   16);
-+if ( !defined("REP_NOT_SQUOT") )
-+  define("REP_NOT_SQUOT",  32);
-+// <--
-+if ( !defined("REP_NOT_QUOTE") )
-+  define("REP_NOT_QUOTE",   16);
-+if ( !defined("REP_NOT_SQUOTE") )
-+  define("REP_NOT_SQUOTE",  32);
-+// --> for backward compatibility
-+if ( !defined("REP_ESC_QUOT") )
-+  define("REP_ESC_QUOT",   64);
-+if ( !defined("REP_ESC_SQUOT") )
-+  define("REP_ESC_SQUOT", 128);
-+// <--
-+// --> ...
-+if ( !defined("REP_ENT_QUOT") )
-+  define("REP_ESC_QUOT",   64);
-+if ( !defined("REP_ENT_SQUOT") )
-+  define("REP_ESC_SQUOT", 128);
-+// <-- ...
-+if ( !defined("REP_ENT_QUOTE") )
-+  define("REP_ESC_QUOTE",   64);
-+if ( !defined("REP_ENT_SQUOTE") )
-+  define("REP_ESC_SQUOTE", 128);
-+
-+/**
-+  * sanitizeString()
-+  * $sUrl:   the URL to be sanitized
-+  * $iWhatNot: optional, the following values may be used ( OR-ed together):
-+  *              REP_NOT_BRACKET:    do not replace brackets ( '(', ')' )
-+  *              REP_NOT_AMPER:      do not replace ampersand ( '&' )
-+  *              REP_NOT_GT:         do not replace '>'
-+  *              REP_NOT_LT:         do not replace '>'
-+  *              REP_NOT_SQUOT:      do not replace singlequotes ( '\'' )
-+  *              REP_NOT_QUOT:       do not replace quotes ( '\"' )
-+  *              REP_ENT_SQUOT:      do not escape, but use html entities for singlequotes ( '\'' )
-+  *              REP_ENT_QUOT:       do not escape, but use html entities for quotes ( '\"' )
-+  *
-+  * Escapes or replaces all special characters in the given String
-+  *
-+  * Returns: the sanitized string
-+  *
-+  **/
-+function sanitizeString($sStr, $iWhatNot = 0)
-+{
-+    $sReturn    = $sStr;
-+    if ( !($iWhatNot & REP_NOT_AMPER) )
-+        $sReturn    = str_replace("&", "&", $sReturn);
-+    if ( ( ($iWhatNot & REP_ENT_SQUOT) ) || ( ($iWhatNot & REP_ENT_SQUOTE) ) )
-+    {
-+        $sReturn    = str_replace("'", "'", $sReturn);
-+        $iWhatNot   += REP_NOT_SQUOT;
-+    }
-+    if ( ( ($iWhatNot & REP_ENT_QUOT) ) || ( ($iWhatNot & REP_ENT_QUOTE) ) )
-+    {
-+        $sReturn    = str_replace("\"", """, $sReturn);
-+        $iWhatNot   += REP_NOT_QUOT;
-+    }
-+    if ( !($iWhatNot & REP_NOT_BRACKET) )
-+    {
-+        $sReturn    = str_replace("(", "", $sReturn);
-+        $sReturn    = str_replace(")", "", $sReturn);
-+    }
-+    if ( !($iWhatNot & REP_NOT_GT) )
-+        $sReturn    = str_replace(">", ">", $sReturn);
-+    if ( !($iWhatNot & REP_NOT_LT) )
-+        $sReturn    = str_replace("<", "<", $sReturn);
-+    if ( !($iWhatNot & REP_NOT_SQUOT) )
-+    {
-+        $sReturn    = str_replace("\'", "'", $sReturn);
-+        $sReturn    = str_replace("'", "\'", $sReturn);
-+    }
-+    if ( !($iWhatNot & REP_NOT_QUOT) )
-+    {
-+        $sReturn    = str_replace("\\\"", "\"", $sReturn);
-+        $sReturn    = str_replace("\"", "\\\"", $sReturn);
-+    }
-+    return $sReturn;
-+}
-+
-+
-+function numerizeString( $sStr)
-+{
-+    return preg_replace("/[^0-9]+/", "", $sStr);
-+}
-+?>
---- boinc-server-6.11.0+r18946.orig/html/szdg-stat/include/stat.inc.php
-+++ boinc-server-6.11.0+r18946/html/szdg-stat/include/stat.inc.php
-@@ -0,0 +1,57 @@
-+<?php
-+/*
-+ * stat.inc.php
-+ * by Marosi Attila Csaba <atisu at sztaki dot hu>
-+ * March 26, 2006
-+ *
-+ * This is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU Lesser General Public
-+ * License as published by the Free Software Foundation;
-+ * either version 2.1 of the License, or (at your option) any later version.
-+ *
-+ * This software is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-+ * See the GNU Lesser General Public License for more details.
-+ *
-+ * To view the GNU Lesser General Public License visit
-+ * http://www.gnu.org/copyleft/lesser.html
-+ * or write to the Free Software Foundation, Inc.,
-+ * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-+ *
-+ *
-+ */
-+
-+ require_once 'include/config.inc.php';
-+ require_once 'include/class/stat.class.php';
-+ require_once 'include/utilities.inc.php';
-+ require_once 'include/class/sqlfunc.class.php';
-+
-+
-+ function getData($sQuery) {
-+	$cSqlFunc = new SqlFunc();
-+	//$cSqlFunc->setDbParams(BOINC_DB_HOST, BOINC_DB_USER, BOINC_DB_PW, BOINC_DB_NAME, "mysql");
-+	$cSqlFunc->setShouldDebug(TRUE);
-+	$cSqlFunc->connectDb();
-+	$cSqlFunc->setShouldDebug(FALSE);
-+	$aRow = $cSqlFunc->fetchRow($sQuery);
-+	return $aRow[0];
-+ }
-+
-+
-+ function insertData($sTableName, $iData) {
-+	$cStat = new Stat($sTableName);
-+	//$cStat->setDbParams(STAT_DB_HOST, STAT_DB_USER, STAT_DB_PW, STAT_DB_NAME, "mysql");
-+	$cStat->setShouldDebug(FALSE);
-+	$cStat->createTable();
-+	$cStat->insertItem($iData);
-+ }
-+
-+
-+function createTextOut( $sFileName, $iData) {
-+ $oFile = fopen(SZDGSTAT_OUTPUT_DIR . '/' . $sFileName, 'w+');
-+ fwrite($oFile, $iData);
-+ fclose($oFile);
-+}
-+
-+?>
---- boinc-server-6.11.0+r18946.orig/html/szdg-stat/include/class/sqlfunc.class.php
-+++ boinc-server-6.11.0+r18946/html/szdg-stat/include/class/sqlfunc.class.php
-@@ -0,0 +1,340 @@
-+<?php
-+/*
-+ *
-+ * sqlfunc.class.php
-+ * by MAROSI Attila Csaba <atisu at su dot co dot hu>
-+ * Dec 5, 2006
-+ *
-+ * This is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU Lesser General Public
-+ * License as published by the Free Software Foundation;
-+ * either version 2.1 of the License, or (at your option) any later version.
-+ *
-+ * This software is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-+ * See the GNU Lesser General Public License for more details.
-+ *
-+ * To view the GNU Lesser General Public License visit
-+ * http://www.gnu.org/copyleft/lesser.html
-+ * or write to the Free Software Foundation, Inc.,
-+ * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-+ *
-+ *
-+ * modified for szdg-stat: connectDb() closeDb()
-+ *
-+ */
-+
-+
-+require_once("include/strfunc.inc.php");
-+require_once("debug.class.php");
-+require_once("../inc/db.inc");
-+
-+Class SqlFunc extends Debug
-+{
-+
-+    var $oSqlConnection_;
-+    var $sSqlDb_;
-+    var $sSqlHost_;
-+    var $sSqlUser_;
-+    var $sSqlPassword_;
-+    var $sSqlType_;
-+
-+    function SqlFunc()
-+    {
-+        Debug::Debug();
-+    }
-+
-+    function setSqlConnection_($oSqlConnection)
-+    {
-+        $this->oSqlConnection_  = $oSqlConnection;
-+    }
-+
-+    function getSqlConnection_()
-+    {
-+        return $this->oSqlConnection_;
-+    }
-+
-+    function setSqlDb_($sSqlDb)
-+    {
-+        $this->sSqlDb_  = $sSqlDb;
-+    }
-+
-+    function getSqlDb_()
-+    {
-+        return $this->sSqlDb_;
-+    }
-+
-+    function setSqlHost_($sSqlHost)
-+    {
-+        $this->sSqlHost_  = $sSqlHost;
-+    }
-+
-+    function getSqlHost_()
-+    {
-+        return $this->sSqlHost_;
-+    }
-+
-+    function setSqlUser_($sSqlUser)
-+    {
-+        $this->sSqlUser_  = $sSqlUser;
-+    }
-+
-+    function getSqlUser_()
-+    {
-+        return $this->sSqlUser_;
-+    }
-+
-+    function setSqlPassword_($sSqlPassword)
-+    {
-+        $this->sSqlPassword_  = $sSqlPassword;
-+    }
-+
-+    function getSqlPassword_()
-+    {
-+        return $this->sSqlPassword_;
-+    }
-+
-+    function setSqlType_($sSqlType)
-+    {
-+        $this->sSqlType_  = $sSqlType;
-+    }
-+
-+    function getSqlType_()
-+    {
-+        return $this->sSqlType_;
-+    }
-+
-+    function setDbParams($sHost, $sUser, $sPassword, $sDb, $sType = "mysql")
-+    {
-+        $this->warnNow_("SqlFunc::setDbParams has been called<br/>");
-+        $this->setErrorMsg_("");
-+        $this->setSqlDb_($sDb);
-+        $this->setSqlHost_($sHost);
-+        $this->setSqlUser_($sUser);
-+        $this->setSqlPassword_($sPassword);
-+        $this->setSqlType_($sType);
-+        return TRUE;
-+    }
-+
-+    function closeDb()
-+    {
-+        //mysql_close($this->oSqlConnection_);
-+    }
-+
-+    function connectDb()
-+    {
-+	/*
-+        $this->setErrorMsg_("");
-+        $this->oSqlConnection_ = mysql_connect($this->getSqlHost_(),
-+                                                $this->getSqlUser_(),
-+                                                $this->getSqlPassword_()) or
-+            $this->dieNow_("SqlFunc->connectDb(): could not connect to server:".
-+                                mysql_error());
-+        mysql_select_db($this->getSqlDb_()) or
-+            $this->dieNow_("SqlFunc->connectDb(): could not select database(". $this->getSqlDb_().
-+                            "):".
-+                            mysql_error());
-+        */
-+	if (db_init_aux())
-+	    $this->dieNow_("SqlFunc->connectDb(): could not open database: " .
-+			                                mysql_error());
-+
-+    }
-+
-+    function fetchRow($sQuery, $sId = "", $bShouldDie = FALSE )
-+    {
-+        $this->setErrorMsg_("");
-+        if ( ( $oResult = $this->doQuery($sQuery, $sId, $bShouldDie) ) ==
-+                FALSE )
-+        {
-+            $this->warnNow_("SqlFunc->fetchRow()[1][".$sId."]: mysql error:".
-+                                mysql_error(). "<br/>");
-+            if ( $bShouldDie )
-+                $this->dieNow_();
-+            return FALSE;
-+        }
-+        $this->warnNow_("SqlFunc->fetchRow()[2]: ". $sQuery. "<br/>");
-+        if ( ( $aRow  = mysql_fetch_array($oResult) ) == FALSE )
-+        {
-+            $this->warnNow_ ("SqlFunc->fetchRow()[3][". $sId. "]: mysql error:".
-+                                mysql_error(). "<br/>");
-+            if ( $bShouldDie )
-+                $this->dieNow_();
-+        }
-+        return $aRow;
-+    }
-+
-+    function fetchArray($oResult)
-+    {
-+        if ( ( $aArray = mysql_fetch_array($oResult) ) == FALSE )
-+        {
-+            $this->warnNow_("SqlFunc->fetchArray(): mysql error:". mysql_error().
-+                             "<br/>");
-+            return FALSE;
-+        }
-+        return $aArray;
-+    }
-+
-+    function fetchArrayResults($sQuery, $sId = "", $bShouldDie = FALSE)
-+    {
-+        if ( ( $oResult = $this->doQuery($sQuery, $sId, $bShouldDie) ) ==
-+                FALSE )
-+        {
-+            $this->warnNow_("SqlFunc->fetchArrayResults()[1][".$sId."]: mysql error:".
-+                                mysql_error(). "<br/>");
-+            if ( $bShouldDie )
-+                $this->dieNow_();
-+            // :-)
-+            return FALSE;
-+        }
-+        while ( ( $aRow = $this->fetchArray($oResult, MYSQL_BOTH) ) == TRUE )
-+        {
-+            $aReturn[] = $aRow;
-+        }
-+        return $aReturn;
-+    }
-+
-+    function doQuery($sQuery, $sId = "", $bShouldDie = FALSE )
-+    {
-+        $this->setErrorMsg_("");
-+        if ( strstr($sQuery, "UPDATE") != FALSE)
-+            $this->warnNow_("SqlFunc->doQuery(): <b>".$sQuery."</b><br/>");
-+        else
-+            $this->warnNow_("SqlFunc->doQuery(): ".$sQuery."<br/>");
-+        $oResult    = mysql_query($sQuery);
-+        if ( $oResult == FALSE )
-+        {
-+            $this->warnNow_("SqlFunc->doQuery()[".$sId."]: mysql error:".
-+                                mysql_error(). "<br/>");
-+            if ( $bShouldDie )
-+                $this->dieNow_();
-+        }
-+        return $oResult;
-+    }
-+
-+	function doInsert($sTable, $aArray) {
-+		if (!is_array($aArray))
-+			return FALSE;
-+		$sSqlQ = "INSERT INTO ". sanitizeString($sTable). " ";
-+		$sNames = "(";
-+		$sValues = " VALUES (";
-+		$iCounter = 1;
-+		$iSize = count($aArray);
-+		// implode?
-+		foreach( $aArray as $sKey => $sValue) {
-+			$sNames .= sanitizeString($sKey);
-+			$sValues .= "'". /*sanitizeString(*/$sValue/*)*/. "'";
-+			if ($iCounter != $iSize) {
-+				$sNames .= ", ";
-+				$sValues .= ", ";
-+			}
-+			$iCounter++;
-+		}
-+		$sNames .= ")";
-+		$sValues .= ")";
-+		$sSqlQ .= $sNames. $sValues;
-+		$oResult = $this->doQuery($sSqlQ);
-+		if ($oResult != FALSE) {
-+			return mysql_insert_id();
-+		} else {
-+			return FALSE;
-+		}
-+	}
-+
-+
-+	function doUpdate($sTable, $aArray, $sIdField="id", $iId)
-+	{
-+		if (!is_array($aArray))
-+			return FALSE;
-+		$sSqlQ = "UPDATE ". sanitizeString($sTable). " SET ";
-+		foreach($aArray as $sKey => $sValue) {
-+			$aSet[]= sanitizeString($sKey). "=\"". sanitizeString($sValue). "\"";
-+		}
-+		// ...
-+		$sSqlQ .= implode(", ", $aSet);
-+		$sSqlQ .= " WHERE ". sanitizeString($sIdField). "=". numerizeString($iId). " LIMIT 1";
-+		return $this->doQuery($sSqlQ);
-+	}
-+
-+
-+	/*
-+	 *
-+	 */
-+
-+    function insertRelCore_($sTableName, $sField1, $sField2, $iId1, $iId2)
-+    {
-+        $this->connectDb();
-+        $oResult = $this->doQuery("INSERT INTO ". sanitizeString($sTableName).
-+			" (". sanitizeString($sField1). ",".
-+			sanitizeString($sField2). ") ". "VALUES (\"". numerizeString($iId1). "\",\"".
-+			numerizeString($iId2). "\")");
-+        $this->closeDb();
-+        return $oResult;
-+    }
-+
-+	function deleteRelCore_($sTableName, $sField1, $sField2, $iId1, $iId2)
-+	{
-+        $this->connectDb();
-+        $oResult = $this->doQuery("DELETE FROM ". sanitizeString($sTableName). " WHERE ".
-+            sanitizeString($sField1). "=". numerizeString($iId1). " AND ".
-+			sanitizeString($sField2). "=".
-+            numerizeString($iId2). " LIMIT 1");
-+        $this->closeDb();
-+        return $oResult;
-+	}
-+
-+    function deleteRelAllCore_($sTableName, $sField, $iId)
-+    {
-+        $this->connectDb();
-+        $oResult = $this->doQuery("DELETE FROM ". sanitizeString($sTableName). " WHERE ".
-+            sanitizeString($sField). "=". numerizeString($iId));
-+        $this->closeDb();
-+        return $oResult;
-+    }
-+
-+	function getLatestCore_($sSelectField, $sTableName, $sOrderBy, $iStart, $iCount, $sWhere = "")
-+	{
-+        $this->connectDb();
-+		$sQuery = "SELECT ". sanitizeString($sSelectField). " FROM ".
-+			sanitizeString($sTableName);
-+		if ($sWhere != "") {
-+			$sQuery .= " WHERE ". sanitizeString($sWhere). " ";
-+		}
-+		$sQuery .= " ORDER BY ". sanitizeString($sOrderBy).
-+			" LIMIT ". numerizeString($iStart). ", ". numerizeString($iCount);
-+		$aResults = $this->fetchArrayResults($sQuery);
-+        $this->closeDb();
-+		return $aResults;
-+	}
-+
-+	function getCountCore_($sTableName, $sWhere="")
-+	{
-+        $this->connectDb();
-+		$sSqlQ="SELECT COUNT(*) FROM ". sanitizeString($sTableName);
-+		if ($sWhere != "") {
-+			$sSqlQ .= " WHERE ". sanitizeString($sWhere);
-+		}
-+		$aRow = $this->fetchRow($sSqlQ);
-+        $this->closeDb();
-+		return $aRow[0];
-+	}
-+
-+	// you can use single quotes in $sWhere
-+	function getAllCore_($sTableName, $sOrderBy="", $sWhere="")
-+	{
-+        $this->connectDb();
-+		$sSqlQ="SELECT * FROM ". sanitizeString($sTableName);
-+		if ($sWhere != "") {
-+			$sSqlQ .= " WHERE ". sanitizeString($sWhere, REP_ENT_SQUOT);
-+		}
-+		if ($sOrderBy != "") {
-+			$sSqlQ .= " ORDER BY ". sanitizeString($sOrderBy);
-+		}
-+		$aResults = $this->fetchArrayResults($sSqlQ);
-+        $this->closeDb();
-+		return $aResults;
-+	}
-+
-+}
-+?>
---- boinc-server-6.11.0+r18946.orig/html/szdg-stat/include/class/stat.class.php
-+++ boinc-server-6.11.0+r18946/html/szdg-stat/include/class/stat.class.php
-@@ -0,0 +1,96 @@
-+<?php
-+/*
-+ * stat.class.php
-+ * by Marosi Attila Csaba <atisu at sztaki dot hu>
-+ * Feb 27, 2006
-+ *
-+ * This is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU Lesser General Public
-+ * License as published by the Free Software Foundation;
-+ * either version 2.1 of the License, or (at your option) any later version.
-+ *
-+ * This software is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-+ * See the GNU Lesser General Public License for more details.
-+ *
-+ * To view the GNU Lesser General Public License visit
-+ * http://www.gnu.org/copyleft/lesser.html
-+ * or write to the Free Software Foundation, Inc.,
-+ * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-+ *
-+ * uses a table named $TableName:
-+ * ------------------------------
-+ *
-+ * int(16)     value
-+ * timestamp   date
-+ *
-+ */
-+
-+require_once 'include/strfunc.inc.php';
-+require_once 'sqlfunc.class.php';
-+
-+class Stat extends SqlFunc {
-+
-+	var $sTableName;
-+	//var $sDbName;
-+
-+	function Stat( /*$sDbName,*/ $sTableName) {
-+		$this->sTableName = sanitizeString( $sTableName);
-+		//$this->sDbName = sanitizeString( $sDbName);
-+	}
-+
-+	/*
-+	 *  creates the table in the given database ( lazyness...)
-+	 */
-+	function createTable() {
-+		$this->connectDb();
-+		$oResult = $this->doQuery("CREATE TABLE ". $this->sTableName. " ( value float, date int(32) )" );
-+		return $oResult;
-+	}
-+
-+	/*
-+	 * inserts a single item into $sTableName with the current timestamp
-+	 */
-+	function insertItem( $iValue) {
-+		$this->connectDb();
-+		$oResult = $this->doQuery("INSERT INTO ". $this->sTableName. " values ('".
-+			$iValue."', UNIX_TIMESTAMP() )");
-+		return $oResult;
-+	}
-+
-+	/*
-+	 *  gets the last ( sorted by date) $iCount entries from $sTableName
-+	 */
-+	function getLastItems( $iCount) {
-+		$this->connectDb();
-+		$oResult= $this->doQuery("SELECT * FROM ". $this->sTableName." ORDER BY date DESC LIMIT ". numerizeString( $iCount));
-+		if ( $oResult == FALSE )
-+            return FALSE;
-+        while ( $aRow = $this->fetchArray($oResult) )
-+        {
-+            $aReturn[]  = $aRow;
-+        }
-+        return $aReturn;
-+	}
-+
-+	function getQuery( $sQuery) {
-+		$this->connectDb();
-+		$oResult= $this->doQuery( $sQuery);
-+		if ( $oResult == FALSE )
-+            return FALSE;
-+        while ( $aRow = $this->fetchArray($oResult) )
-+        {
-+            $aReturn[]  = $aRow;
-+        }
-+        return $aReturn;
-+	}
-+
-+	function getLastItemsAfterNowMinus($sSeconds) {
-+		return $this->getQuery('SELECT * FROM '. $this->sTableName. ' WHERE '.
-+			'date>=UNIX_TIMESTAMP()-'. sanitizeString($sSeconds, REP_NOT_BRACKET).
-+			' ORDER BY date');
-+	}
-+
-+}
-+?>
---- boinc-server-6.11.0+r18946.orig/html/szdg-stat/include/class/debug.class.php
-+++ boinc-server-6.11.0+r18946/html/szdg-stat/include/class/debug.class.php
-@@ -0,0 +1,83 @@
-+<?php
-+/*
-+ *
-+ * debug.inc.php
-+ * by MAROSI Attila Csaba <atisu at su dot co dot hu>
-+ * 20031027
-+ *
-+ * This is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU Lesser General Public
-+ * License as published by the Free Software Foundation;
-+ * either version 2.1 of the License, or (at your option) any later version.
-+ *
-+ * This software is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-+ * See the GNU Lesser General Public License for more details.
-+ *
-+ * To view the GNU Lesser General Public License visit
-+ * http://www.gnu.org/copyleft/lesser.html
-+ * or write to the Free Software Foundation, Inc.,
-+ * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-+ *
-+ */
-+
-+
-+Class Debug
-+{
-+    var $bShouldDebug_;
-+    var $sErrorMsg_;
-+
-+    function Debug()
-+    {
-+        $this->bShouldDebug_  = FALSE;
-+    }
-+
-+    function getErrorMsg()
-+    {
-+        return $this->sErrorMsg_;
-+    }
-+
-+    function setErrorMsg_($sMessage)
-+    {
-+        $this->sErrorMsg_  = $sMessage;
-+    }
-+
-+    function shouldDebug()
-+    {
-+        return $this->bShouldDebug_;
-+    }
-+
-+    function setShouldDebug($bShouldDebug)
-+    {
-+        $this->bShouldDebug_    = $bShouldDebug;
-+    }
-+
-+    function getShouldDebug()
-+    {
-+        return $this->bShouldDebug_;
-+    }
-+
-+    function dieNow_($sMessage = "", $sErrorMsg = "")
-+    {
-+        $this->setErrorMsg_($sErrorMsg);
-+        if ( $this->shouldDebug() )
-+        {
-+            die($sMessage);
-+        }
-+        else
-+        {
-+            die();
-+        }
-+        return TRUE;
-+    }
-+
-+    function warnNow_($sMessage, $sErrorMsg = "")
-+    {
-+        $this->setErrorMsg_($sErrorMsg);
-+        if ( $this->shouldDebug() )
-+            printf("%s", $sMessage);
-+        return TRUE;
-+    }
-+}
-+?>
---- boinc-server-6.11.0+r18946.orig/html/szdg-stat/include/class/chart.class.php
-+++ boinc-server-6.11.0+r18946/html/szdg-stat/include/class/chart.class.php
-@@ -0,0 +1,323 @@
-+<?php
-+/*
-+ * chart.class.php
-+ * by Marosi Attila Csaba <atisu at sztaki dot hu>
-+ * March 26, 2006
-+ *
-+ * This is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU Lesser General Public
-+ * License as published by the Free Software Foundation;
-+ * either version 2.1 of the License, or (at your option) any later version.
-+ *
-+ * This software is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-+ * See the GNU Lesser General Public License for more details.
-+ *
-+ * To view the GNU Lesser General Public License visit
-+ * http://www.gnu.org/copyleft/lesser.html
-+ * or write to the Free Software Foundation, Inc.,
-+ * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-+ *
-+ *
-+ */
-+
-+require_once 'include/strfunc.inc.php';
-+require_once 'include/utilities.inc.php';
-+
-+class Chart {
-+    // size of the whole picture
-+    var $iWidth;
-+    var $iHeight;
-+    //// number of items on the x/y
-+    //var $iXNOI;
-+    //var $iYNOI;
-+    // the items on the x/y [ array of strings]
-+    var $aItems;
-+    // the gd image object
-+    var $oImage;
-+    // the rectangle used for drawing the graph
-+    var $iGWidth;
-+    var $iGHeight;
-+    // top left corner
-+    var $iGTX;
-+    var $iGTY;
-+    // bottom right corner
-+    var $iGBX;
-+    var $iGBY;
-+    // name of the Y-Axis
-+    var $sYName;
-+    // adjustment (+-) of the names on the X-Axis
-+    var $iXTextPosAdjust;
-+    // Position of the Y-Axis ( 'left'/ 'right')
-+    var $sYPosition;
-+    // every $iXTextFilter th peak will be printed
-+    var $iYTextFilter;
-+    // title of the chart;
-+    var $sTitle;
-+    // ????
-+    var $sPrintYValue;
-+    // colors
-+    var $oCBlack;
-+    var $oCGrey1;
-+    var $oCGrey2;
-+    var $oCGrey3;
-+    var $oCGrey4;
-+    var $oCWhite;
-+    var $oCIntRec;
-+    var $oCChart;
-+    var $oCChartWE;
-+    var $oCYText;
-+    var $oCBG;
-+    // linestyles
-+    var $aLineStyle1;
-+    var $aLineStyle2;
-+    var $aLineStyle3;
-+    // how sould the size of one unit on the X-Axis calculated
-+    // 'time': (timestamp(latest_item)-timestamp(earliest_item))/($this->iGBX-$this->iGTX)
-+    // 'normal': ($this->iGBX-$this->iGTX)/number_of_items
-+    var $sSizeOfUnitXCalcMethod;
-+
-+    function Chart( $iWidth, $iHeight) {
-+		$this->iWidth=numerizeString($iWidth);
-+		$this->iHeight=numerizeString($iHeight);
-+		$this->sYPosition='left';
-+		$this->sPrintYValue='normal';
-+		$this->iYTextFilter=1;
-+		$this->sSizeOfUnitXCalcMethod='normal';
-+		// allocate image
-+		$this->oImage=imagecreatetruecolor($this->iWidth, $this->iHeight+20);
-+		// allocate colors
-+		$this->oCBlack=imagecolorallocate($this->oImage, 0, 0, 0);
-+		$this->oCGrey1=imagecolorallocate($this->oImage, 0xF8, 0xF8, 0xF8);
-+		$this->oCGrey2=imagecolorallocate($this->oImage, 0x81, 0x81, 0x81);
-+		$this->oCGrey3=imagecolorallocate($this->oImage, 0x31, 0x31, 0x31);
-+		$this->oCGrey4=imagecolorallocate($this->oImage, 0xEE, 0xEE, 0xEE);
-+		$this->oCWhite=imagecolorallocate($this->oImage, 0xFF, 0xFF, 0xFF);
-+		$this->oCIntRec=imagecolorallocate($this->oImage, 0xC5, 0xD5, 0xFF);
-+		$this->oCChart=imagecolorallocate($this->oImage, 0x55, 0x65, 0xC1);
-+		$this->oCChartWE=imagecolorallocate($this->oImage, 0x81, 0x81, 0xC1);
-+		$this->oCYText=imagecolorallocate($this->oImage, 0x00, 0x00, 0x00);
-+		$this->oCBG=imagecolorallocate($this->oImage, 0xC5, 0xD5, 0xFF);
-+        // set linestyles
-+		$this->aLineStyle1=array($this->oCGrey3, $this->oCGrey4, $this->oCGrey4);
-+		$this->aLineStyle2=array($this->oCWhite);
-+		$this->aLineStyle3=array($this->oCGrey4, $this->oCGrey4, $this->oCBlack);
-+    }
-+
-+	// draws the chart,
-+	//  but first it fills the background
-+	function draw() {
-+		// fill the background
-+		imagefilledrectangle($this->oImage, 0, 0, $this->iWidth, $this->iHeight+20,
-+			$this->oCBG);
-+		// internal not-so-grey rectangle: this will be used for the graph
-+		$this->iGTX=30;
-+		$this->iGTY=30;
-+		$this->iGBX=$this->iWidth-55;
-+		$this->iGBY=$this->iHeight-31;
-+		if ($this->sYPosition=='left')
-+			imagefilledrectangle($this->oImage, $this->iGTX, $this->iGTY-5, $this->iGBX+5,
-+				$this->iGBY, $this->oCIntRec);
-+		else
-+			imagefilledrectangle($this->oImage, $this->iGTX-5, $this->iGTY-5, $this->iGBX,
-+				$this->iGBY, $this->oCIntRec);
-+		// the highest value in the array ( x field)
-+		// division by zero problem if iMaxY==0
-+		$iMaxY=1;
-+		foreach ($this->aItems as $aItem) {
-+		  if ($aItem['y']>$iMaxY)
-+			$iMaxY=$aItem['y'];
-+		}
-+		// draw the Y-Axis
-+		if ( strcmp( $this->sYPosition, 'left') == 0)
-+			$iYAxisXPos=30;
-+		else
-+			$iYAxisXPos=$this->iWidth-55;
-+		imageline($this->oImage, $iYAxisXPos, 10, $iYAxisXPos, $this->iHeight-20,
-+			$this->oCGrey2);
-+		imageline($this->oImage, $iYAxisXPos, 10, $iYAxisXPos, $this->iHeight-21,
-+			$this->oCGrey3);
-+		imageline($this->oImage, $iYAxisXPos-1, 10, $iYAxisXPos-1, $this->iHeight-20,
-+			$this->oCGrey2);
-+		imageline($this->oImage, $iYAxisXPos+1, 10, $iYAxisXPos+1, $this->iHeight-20,
-+			$this->oCGrey2);
-+		imagefilledarc($this->oImage, $iYAxisXPos, 5, 40, 30, 75, 105, $this->oCGrey3,
-+			IMG_ARC_CHORD);
-+		// draw the X-Axis
-+		// TODO: arrow on both sides
-+		imageline($this->oImage, 20, $this->iHeight-29, $this->iWidth-35, $this->iHeight-29,
-+			$this->oCGrey2);
-+		imageline($this->oImage, 20, $this->iHeight-30, $this->iWidth-35, $this->iHeight-30,
-+			$this->oCGrey2);
-+		imageline($this->oImage, 21, $this->iHeight-30, $this->iWidth-35, $this->iHeight-30,
-+			$this->oCGrey3);
-+		imageline($this->oImage, 20, $this->iHeight-31, $this->iWidth-35, $this->iHeight-31,
-+			$this->oCGrey2);
-+		imagefilledarc($this->oImage, $this->iWidth-30, $this->iHeight-30, 30, 40, 165, 195,
-+			$this->oCGrey3, IMG_ARC_CHORD);
-+		reset($this->aItems);
-+		// print the name above the Y-Axis
-+		if ($this->sYPosition=='left')
-+			imagestring($this->oImage, 2, 33, -3, $this->sYName, $this->oCBlack);
-+		else
-+			imagestring($this->oImage, 2, $this->iGBX-3-(strlen($this->sYName)*6),
-+				-3, $this->sYName, $this->oCBlack);
-+		// print the title
-+		if ($this->sTitle)
-+			imagestring($this->oImage, 5, ($this->iWidth-strlen($this->sTitle)*8)/2, 2,
-+				$this->sTitle, $this->oCBlack);
-+		// count the size of one unit on the Y-Axis
-+		if (($iItemCount=count($this->aItems))<=0)
-+			 $iItemCount=1;
-+		$iSizeOfUnitY=($this->iGBY-$this->iGTY)/$iMaxY;
-+		// TODO: the size SizeOfUnitX should be calculated based upon the elapsed time
-+		//       between the first and last item, now it is calculated with the number of
-+		//       available elements
-+		if ($this->sSizeOfUnitXCalcMethod=='normal') {
-+			$iSizeOfUnitX=($this->iGBX-$this->iGTX)/$iItemCount;
-+			// draw the chart -->
-+			// a seperate polygon for each value. it allows to use different colors
-+			//  for different dates
-+			for ($iCounter=0; $iCounter<=$iItemCount-1; $iCounter++) {
-+				// bottom
-+				$aLine[]=$this->iGTX+round($iCounter*$iSizeOfUnitX);
-+				$aLine[]=$this->iGBY;
-+				// the current value
-+				$aLine[]=round($iSizeOfUnitX*$iCounter+$this->iGTX);
-+				$aLine[]=round($this->iGBY-$this->aItems[$iCounter]['y']*$iSizeOfUnitY);
-+				// the next value
-+				$aLine[]=round($iSizeOfUnitX*($iCounter+1)+$this->iGTX);
-+				$aLine[]=round($this->iGBY-$this->aItems[$iCounter]['y']*$iSizeOfUnitY);
-+				// bottom again
-+				$aLine[]=$this->iGTX+round(($iCounter+1)*$iSizeOfUnitX);
-+				$aLine[]=$this->iGBY;
-+				// draw it, but with different colors for weekdays and for the weekend
-+				if (isWeekend($this->aItems[$iCounter]['x']) &&
-+					((isWeekend($this->aItems[$iCounter+1]['x']) ||
-+					(!isset($this->aItems[$iCounter+1]['x'])))) )
-+					imagefilledpolygon($this->oImage, $aLine, 4, $this->oCChartWE);
-+				else
-+					imagefilledpolygon($this->oImage, $aLine, 4, $this->oCChart);
-+				// clean up
-+				unset($aLine);
-+			}
-+			// <--
-+		}
-+		// horizontal dotted lines and the corresponding values
-+		imagesetstyle($this->oImage, $this->aLineStyle1);
-+		$iLineInc=($this->iGBY-$this->iGTY)/2;
-+		for ($iTemp=1; $this->iGBY-$iTemp*$iLineInc>=$this->iGTY-5; $iTemp++) {
-+				imageline($this->oImage, $this->iGTX, ($this->iGBY)-$iTemp*$iLineInc,
-+					$this->iGBX, ($this->iGBY)-$iTemp*$iLineInc, IMG_COLOR_STYLED);
-+				if ( $this->sYPosition == 'left') {
-+					imagestring($this->oImage,
-+						    2,
-+							$this->iGBX+7,
-+							($this->iGBY)-$iTemp*$iLineInc,
-+							round( $iMaxY/(3-$iTemp), 3),
-+							$this->oCBlack);
-+				} else {
-+					imagestring( $this->oImage,
-+							2,
-+							$this->iGTX-10,
-+							($this->iGBY)-$iTemp*$iLineInc,
-+							round( $iMaxY/(3-$iTemp), 3),
-+							$this->oCBlack);
-+				}
-+		}
-+		$iCounter=0;
-+		$iDrawCounter=0;
-+		$iLastValue=0;
-+		foreach ($this->aItems as $aItem) {
-+			// print values to the top of each peak
-+			$aNextValue=next($this->aItems);
-+			$iNextValue=$aNextValue['y'];
-+			// printing values routines for 'normal' and 'maxmin' are the same
-+			//  just the conditions differ
-+		    if ((($this->sPrintYValue=='normal') &&
-+				 (($iCounter % $this->iYTextFilter==0) ||
-+				 (count($this->aItems)-1==$iCounter))) ||
-+				// conditions for 'maxmin'
-+				(($this->sPrintYValue=='maxmin') &&
-+			     ((($iLastValue < $aItem['y']) && ($iNextValue < $aItem['y'])) ||
-+				 (($iLastValue > $aItem['y']) && ($iNextValue > $aItem['y']))))) {
-+				// draw vertical dotted lines
-+				// do not print the last line
-+				if ($this->aItems[count($this->aItems)-1]['y'] != $aItem['y']) {
-+					imagesetstyle($this->oImage, $this->aLineStyle3);
-+					imageline($this->oImage,
-+					   round($iSizeOfUnitX*$iCounter+$this->iGTX),
-+					   round($this->iGBY-$aItem['y']*$iSizeOfUnitY),
-+					   round($iSizeOfUnitX*$iCounter+$this->iGTX),
-+					   $this->iGBY,
-+					   IMG_COLOR_STYLED);
-+					// print values for the X-Axis
-+					// do not print the last value
-+					imagestring($this->oImage,
-+							3,
-+							round($iSizeOfUnitX*$iCounter+$this->iGTX-3),
-+							round($this->iGBY-$aItem['y']*$iSizeOfUnitY-12),
-+							$aItem['y'],
-+							$this->oCYText);
-+				}
-+				$iItemXCounter=0;
-+				// print the timestamp at the bottom
-+				// first the day and month, then the hour and minute
-+				imagestring($this->oImage,
-+					2,
-+					round($iSizeOfUnitX*$iCounter+$this->iGTX+5+
-+							$this->iXTextPosAdjust),
-+					round($this->iGBY+6+(1-($iCounter % 2))*count($aItem['x'])*10),
-+					date('M j', $aItem['x']),
-+					$this->oCBlack);
-+				imagestring( $this->oImage,
-+					2,
-+					round($iSizeOfUnitX*$iCounter+$this->iGTX+5+
-+							$this->iXTextPosAdjust),
-+					round($this->iGBY+6+(1-($iCounter % 2))*count($aItem['x'])*10+11),
-+					date('G:i', $aItem['x']),
-+					$this->oCBlack);
-+				$iDrawCounter++;
-+			 }
-+			 $iCounter++;
-+			 $iLastValue = $aItem['y'];
-+		}
-+		// print the last value next to the Y-Axis
-+		if ($this->sYPosition=='right')
-+			imagestring($this->oImage, 3,
-+				round($iSizeOfUnitX*$iCounter+$this->iGTX+10),
-+				round($this->iGBY-$aItem['y']*$iSizeOfUnitY-16),
-+				$iLastValue,
-+				$this->oCYText);
-+		// TODO: print the last value next to the Y-Axis if sYPosition=='left'
-+	}
-+
-+	function dump() {
-+		imagejpeg($this->oImage, "", 100);
-+	}
-+
-+	function reset() {
-+		unset($this->aItems);
-+	}
-+
-+	function destroy() {
-+		imagedestroy($this->oImage);
-+	}
-+
-+	function writeToFile($sFilename) {
-+		$this->draw();
-+		ob_start();
-+		$this->dump();
-+		$sJpeg=ob_get_contents();
-+		ob_end_clean();
-+		if (!($oHandle=fopen($sFilename, "w+"))) {
-+			echo "could not open ". $sFilename. " for writing";
-+		} else {
-+			fwrite($oHandle, $sJpeg);
-+			fclose($oHandle);
-+		}
-+	}
-+
-+}
-+?>
---- boinc-server-6.11.0+r18946.orig/html/szdg-stat/include/class/displayhosts.class.php
-+++ boinc-server-6.11.0+r18946/html/szdg-stat/include/class/displayhosts.class.php
-@@ -0,0 +1,154 @@
-+<?
-+
-+include_once 'include/rrd_utils.inc.php';
-+include_once 'include/strfunc.inc.php';
-+require_once 'include/class/sqlfunc.class.php';
-+
-+define("OTHER_HOSTS", "Other/ private hosts");
-+
-+Class DisplayHosts {
-+
-+  var $aNetworks;
-+  var $aHostClasses;
-+
-+  /**
-+   *  Constructor
-+   *  @param $aNetworks array key: host class, value: network mask.
-+   *  @returns nothing
-+   */
-+  function DisplayHosts($aNetworks) {
-+    $this->aNetworks = $aNetworks;
-+    $this->aHostClasses = Array();
-+  }
-+
-+
-+  function add($sIp, $sImageFile, $aResult) {
-+    if (!is_array($this->aNetworks))
-+      return FALSE;
-+    $sIpAddr = str_pad(decbin(my_ip2long($sIp)), 32, "0", STR_PAD_LEFT);
-+    foreach ($this->aNetworks as $sName_ => $aDomains_) {
-+      foreach ($aDomains_ as $sDomain_) {
-+	$sNetwork = explode("/", $sDomain_);
-+	$sNetAddr = str_pad(decbin(my_ip2long($sNetwork[0])), 32, "0", STR_PAD_LEFT);
-+	$sCidr = $sNetwork[1];
-+	if (!strcmp(substr($sNetAddr, 0, $sCidr), substr($sIpAddr, 0, $sCidr))) {
-+	  $this->aHostClasses[$sName_][] = array("image" => $sImageFile, "result" => $aResult);
-+	  return TRUE;
-+	}
-+      }
-+    }
-+    $this->aHostClasses[OTHER_HOSTS][] =
-+      array("image" => $sImageFile, "result" => $aResult);;
-+    return TRUE;
-+  }
-+
-+  function calcTotalCreditByClass() {
-+    $oSqlFunc = new SqlFunc();
-+    $oSqlFunc->connectDb();
-+    foreach ($this->aNetworks as $sName_ => $aDomains_) {
-+      $aQueryWhere_ = Array();
-+      foreach ($aDomains_ as $sDomain_) {
-+	$aNetwork = explode("/", $sDomain_);
-+	$aQueryWhere_[] = "(INET_ATON(last_ip_addr) >= INET_ATON('". sanitizeString($aNetwork[0]). "') AND ".
-+	  "INET_ATON(last_ip_addr) < (INET_ATON('". sanitizeString($aNetwork[0]). "') + (1 << ". (32-numerizeString($aNetwork[1]))." )))";
-+      }
-+      $sQueryWhere = implode(" OR ", $aQueryWhere_);
-+      $sQuery = "SELECT SUM(total_credit) AS credit FROM host WHERE ". $sQueryWhere;
-+      $aRow = $oSqlFunc->fetchRow($sQuery);
-+      $aReturn[sanitizeString($sName_)] = round($aRow['credit']);
-+      $iCredit += round($aRow['credit'], 2);
-+    }
-+    ksort($aReturn);
-+    $sQuery = "SELECT SUM(total_credit) AS credit FROM host";
-+    $aRow = $oSqlFunc->fetchRow($sQuery);
-+    $aReturn[OTHER_HOSTS] = round($aRow['credit'] - $iCredit);
-+    $aReturn['Total'] = round($aRow['credit']);
-+    return $aReturn;
-+  }
-+
-+  function printPageCredit($sFile) {
-+    $aCredits = $this->calcTotalCreditByClass();
-+    // --> duplicate code
-+    $iHostsTotal = 0;
-+    if (is_array($this->aHostClasses)) {
-+      foreach ($this->aHostClasses as $sKey => $aHostClass) {
-+	$iHostsTotal += count($aHostClass);
-+      }
-+    }
-+    // <--
-+    ob_start();
-+    ?>
-+    <div class="credit">
-+      <table>
-+	 <tr>
-+	 <th>Institute</th>
-+	 <th>Active hosts</th>
-+	 <th>Total credit (including active and inactive hosts)</th>
-+	 <th>Percent of total credit</th>
-+	 </tr>
-+	 <?
-+	 foreach ($aCredits as $sName_ => $iCredit_) {
-+	   $fTotal = floatval($aCredits['Total']);
-+	   $fPrecent = ($fTotal<=0?"0":number_format(round($iCredit_/$fTotal*100, 2),2));
-+	   echo "<tr style='". ($sName_ == "Total" ? 'background-color: #F5CACA;' : ''  ). "'>";
-+	   echo "<td >". $sName_. "</td>".
-+	     "<td  style='text-align: right;'>". ($sName_ == "Total" ? $iHostsTotal : count($this->aHostClasses[$sName_])). "</td>".
-+	     "<td style='text-align: right;'>". $iCredit_. "</td>".
-+	     "<td style='text-align: right;'>". $fPercent. "%</td>";
-+	   echo "</tr>";
-+											}
-+	?>
-+         </table>
-+	 </div>
-+	 <ul>
-+	     <li><strong>Institute</strong>: name of institute donating resources (hosts).</li>
-+	     <li><strong>Active hosts</strong>: number of hosts active (contacting the server) for the last 14 days.</li>
-+	     <li><strong>Total credit</strong>: sum of the credit granted to all resources (regardless of its current status - active or inactive) of the given institute. </li>
-+	 </ul>
-+	<?
-+    $sText = ob_get_clean();
-+    file_put_contents($sFile, $sText);
-+  }
-+
-+
-+  function printPage($sFile) {
-+    $aHostsBy = array();
-+    $iHostsTotal = 0;
-+    if (is_array($this->aHostClasses)) {
-+      ksort($this->aHostClasses);
-+      foreach ($this->aHostClasses as $sKey => $aHostClass) {
-+	$aHostsBy[]= "<a class=\"hostclass\" href=\"#". sanitizeString($sKey). "\">".
-+	  sanitizeString($sKey). "</a> (". count($aHostClass). ")";
-+	$iHostsTotal += count($aHostClass);
-+      }
-+    }
-+    $sHostsBy = implode(", ", $aHostsBy);
-+
-+    ob_start();
-+    ?>
-+           <b><?=$iHostsTotal?></b> active hosts total. <?if (!empty($aHostsBy)):?>Hosts are provided by: <? echo $sHostsBy; endif?>
-+    <?
-+    if (is_array($this->aHostClasses)) {
-+      foreach ($this->aHostClasses as $sKey => $aHostClass) {
-+	?>
-+	<div class="section">
-+	    <h1><a class="named" name="<?=sanitizeString($sKey)?>"><?=sanitizeString($sKey)?></a></h1>
-+            <?
-+            foreach ($aHostClass as $aHost) {
-+	      echo "<img src=\"stats/". $aHost["image"]. "\"/>\n";
-+            }
-+	    ?>
-+	</div>
-+	<?
-+      }
-+    }
-+    ?>
-+	      <div class="footer">Last generated: <?=date("r")?></div>
-+    <?
-+    $sText = ob_get_clean();
-+    file_put_contents($sFile, $sText);
-+  }
-+
-+}
-+
-+?>
 --- boinc-server-6.11.0+r18946.orig/html/project.sample/project.inc
 +++ boinc-server-6.11.0+r18946/html/project.sample/project.inc
 @@ -7,11 +7,11 @@
diff --git a/debian/html/szdg-stat/chart_hosts.php b/debian/html/szdg-stat/chart_hosts.php
new file mode 100644
index 0000000..88c4c02
--- /dev/null
+++ b/debian/html/szdg-stat/chart_hosts.php
@@ -0,0 +1,52 @@
+#! /usr/bin/env php
+<?php
+/*
+ * chart_hosts.php
+ * by Marosi Attila Csaba <atisu at sztaki dot hu>
+ * March 26, 2006
+ *
+ * This is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * To view the GNU Lesser General Public License visit
+ * http://www.gnu.org/copyleft/lesser.html
+ * or write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ *
+ */
+
+ require_once 'include/config.inc.php';
+ require_once 'include/class/chart.class.php';
+ require_once 'include/utilities.inc.php';
+ require_once 'include/class/stat.class.php';
+
+ // common stuff
+ $cStat=new Stat(STAT_TABLE_HOSTS);
+ //$cStat->setDbParams(STAT_DB_HOST, STAT_DB_USER, STAT_DB_PW, STAT_DB_NAME);
+ $cStat->setShouldDebug(FALSE);
+ $cChart=new Chart(900, 300);
+ $cChart->iXTextPosAdjust=-25;
+ $cChart->sYPosition='right';
+ $cChart->sPrintYValue='normal';
+
+ // number of hosts for the last 28 days -->
+ //  common
+ $aItems=$cStat->getLastItemsAfterNowMinus(3600*24*28);
+ if (!($cChart->iYTextFilter=round(count($aItems)/10)))
+	$cChart->iYTextFilter=1;
+ foreach ($aItems as $aItem)
+	$cChart->aItems[]=array(x=>$aItem['date'], y=>round($aItem['value'],1));
+ $cChart->sYName='Hosts';
+ $cChart->writeToFile(SZDGSTAT_OUTPUT_DIR . '/hosts28day.jpg');
+ // <--
+
+ $cChart->destroy();
+?>
diff --git a/debian/html/szdg-stat/chart_performance.php b/debian/html/szdg-stat/chart_performance.php
new file mode 100644
index 0000000..20d6ea9
--- /dev/null
+++ b/debian/html/szdg-stat/chart_performance.php
@@ -0,0 +1,74 @@
+#! /usr/bin/env php
+<?php
+/*
+ * chart_performance.php
+ * by Marosi Attila Csaba <atisu at sztaki dot hu>
+ * March 26, 2006
+ *
+ * This is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * To view the GNU Lesser General Public License visit
+ * http://www.gnu.org/copyleft/lesser.html
+ * or write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ *
+ */
+
+ require_once 'include/config.inc.php';
+ require_once 'include/class/chart.class.php';
+ require_once 'include/utilities.inc.php';
+ require_once 'include/class/stat.class.php';
+
+ // common stuff
+ $cStat=new Stat(STAT_TABLE_PERF);
+ //$cStat->setDbParams(STAT_DB_HOST, STAT_DB_USER, STAT_DB_PW, STAT_DB_NAME);
+ $cStat->setShouldDebug(FALSE);
+ $cChart=new Chart(900, 300);
+ $cChart->sYName='GFLOP/s';
+ $cChart->iXTextPosAdjust=-25;
+ $cChart->sYPosition='right';
+ $cChart->sPrintYValue='normal';
+
+ // performance for the last 28 days -->
+ //  common
+ $aItems=$cStat->getLastItemsAfterNowMinus(3600*24*28);
+ if (!($cChart->iYTextFilter=round(count($aItems)/10)))
+	$cChart->iYTextFilter=1;
+ foreach ($aItems as $aItem)
+	$cChart->aItems[]=array(x=>$aItem['date'], y=>round($aItem['value'],1));
+ $cChart->writeToFile(SZDGSTAT_OUTPUT_DIR . '/performance28day.jpg');
+ // <--
+
+ // performance for the last 48 hours
+ //  common
+ $cChart->reset();
+ $aItems=$cStat->getLastItemsAfterNowMinus(3600*48);
+ if (!($cChart->iYTextFilter=round(count($aItems)/10)))
+	$cChart->iYTextFilter=1;
+ foreach ($aItems as $aItem)
+	$cChart->aItems[]=array(x=>$aItem['date'], y=>round($aItem['value'],1));
+ $cChart->writeToFile(SZDGSTAT_OUTPUT_DIR . '/performance48.jpg');
+ // <--
+
+ // performance for the last 168 hours
+ //  common
+ $cChart->reset();
+ $aItems=$cStat->getLastItemsAfterNowMinus(3600*168);
+ if (!($cChart->iYTextFilter=round(count($aItems)/10)))
+	$cChart->iYTextFilter=1;
+ foreach ($aItems as $aItem)
+	$cChart->aItems[]=array(x=>$aItem['date'], y=>round($aItem['value'],1));
+ $cChart->writeToFile(SZDGSTAT_OUTPUT_DIR . '/performance168.jpg');
+ // <--
+
+ $cChart->destroy();
+?>
diff --git a/debian/html/szdg-stat/chart_users.php b/debian/html/szdg-stat/chart_users.php
new file mode 100644
index 0000000..a579e55
--- /dev/null
+++ b/debian/html/szdg-stat/chart_users.php
@@ -0,0 +1,52 @@
+#! /usr/bin/env php
+<?php
+/*
+ * chart_users.php
+ * by Marosi Attila Csaba <atisu at sztaki dot hu>
+ * March 26, 2006
+ *
+ * This is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * To view the GNU Lesser General Public License visit
+ * http://www.gnu.org/copyleft/lesser.html
+ * or write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ *
+ */
+
+ require_once 'include/config.inc.php';
+ require_once 'include/class/chart.class.php';
+ require_once 'include/utilities.inc.php';
+ require_once 'include/class/stat.class.php';
+
+ // common stuff
+ $cStat=new Stat(STAT_TABLE_USERS);
+ //$cStat->setDbParams(STAT_DB_HOST, STAT_DB_USER, STAT_DB_PW, STAT_DB_NAME);
+ $cStat->setShouldDebug(FALSE);
+ $cChart=new Chart(900, 300);
+ $cChart->iXTextPosAdjust=-25;
+ $cChart->sYPosition='right';
+ $cChart->sPrintYValue='normal';
+
+ // number of users for the last 28 days -->
+ //  common
+ $aItems=$cStat->getLastItemsAfterNowMinus(3600*24*28);
+ if (!($cChart->iYTextFilter=round(count($aItems)/10)))
+	$cChart->iYTextFilter=1;
+ foreach ($aItems as $aItem)
+	$cChart->aItems[]=array(x=>$aItem['date'], y=>round($aItem['value'],1));
+ $cChart->sYName='Users';
+ $cChart->writeToFile(SZDGSTAT_OUTPUT_DIR . '/users28day.jpg');
+ // <--
+
+ $cChart->destroy();
+?>
diff --git a/debian/html/szdg-stat/chart_workers.php b/debian/html/szdg-stat/chart_workers.php
new file mode 100644
index 0000000..dbd9eda
--- /dev/null
+++ b/debian/html/szdg-stat/chart_workers.php
@@ -0,0 +1,69 @@
+#! /usr/bin/env php
+<?php
+/*
+ * chart_performance.php
+ * by Marosi Attila Csaba <atisu at sztaki dot hu>
+ * Aug 23, 2005
+ *
+ * modifing or using without written permission is prohibited.
+ *
+ */
+
+ require_once 'include/config.inc';
+ require_once 'include/class/chart.class.php';
+ require_once 'include/utilities.inc';
+ require_once 'include/class/sqlfunc.class.php';
+ require_once 'include/class/stat.class.php';
+
+ $sPicOutputFile = SZDGSTAT_OUTPUT_DIR . '/workers24.jpg';
+ $iChartWidth = 900;
+ $iChartHeight = 300;
+ $sTableName = "szdg_stat_workers";
+ $iItemCount = 24;
+ $sYName = "db";
+ $iXTextPosAdjust = -25;
+ $sYPosition = 'right';
+ // maxmin / normal
+ $sPrintYValue = "normal";
+
+ $cStat = new Stat($sTableName);
+ $cStat->setShouldDebug(FALSE);
+ $cChart = new Chart($iChartWidth, $iChartHeight);
+ $cChart->sYName = $sYName;
+ $cChart->iXTextPosAdjust= $iXTextPosAdjust;
+ $cChart->sYPosition = $sYPosition;
+ $cChart->sPrintYValue = $sPrintYValue;
+ $aItems = $cStat->getLastItems($iItemCount);
+ $aItems = array_reverse($aItems);
+ $iCount = round(count($aItems) / 10);
+ if ($iCount == 0 )
+	$iCount++;
+ $cChart->iYTextFilter = $iCount;
+ $iTCounter = 0;
+ foreach ($aItems as $aItem) {
+	$iY = $aItem['value'];
+	unset($iXH);
+	if ($iTCounter+1 != count($aItems) )  {
+		$iXH[] = date("Md", $aItem['date']);
+		$iXH[] = date("H:i", $aItem['date']);
+	} else {
+		$iXH[] = " most";
+	}
+	$cChart->aItems[] = array(x => $iXH, y => $iY);
+	$iTCounter++;
+ }
+ ob_start();
+ $cChart->Init();
+ //header("Content-type: image/jpeg");
+ //header("Content-transfer-Encoding: binary");
+ $cChart->Dump();
+ $sJpeg = ob_get_contents();
+ ob_end_clean();
+ if  (!($oHandle = fopen($sPicOutputFile, "w+")) ) {
+	echo "could not open ". $sPicOutputFile. " for writing";
+ } else {
+	fwrite($oHandle, $sJpeg);
+	fclose($oHandle);
+ }
+ $cChart->Done();
+?>
diff --git a/debian/html/szdg-stat/chart_wu_inprogress.php b/debian/html/szdg-stat/chart_wu_inprogress.php
new file mode 100644
index 0000000..3c81d2a
--- /dev/null
+++ b/debian/html/szdg-stat/chart_wu_inprogress.php
@@ -0,0 +1,52 @@
+#! /usr/bin/env php
+<?php
+/*
+ * chart_wu_inprogress.php
+ * by Marosi Attila Csaba <atisu at sztaki dot hu>
+ * June 14, 2006
+ *
+ * This is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * To view the GNU Lesser General Public License visit
+ * http://www.gnu.org/copyleft/lesser.html
+ * or write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ *
+ */
+
+ require_once 'include/config.inc.php';
+ require_once 'include/class/chart.class.php';
+ require_once 'include/utilities.inc.php';
+ require_once 'include/class/stat.class.php';
+
+ // common stuff
+ $cStat=new Stat(STAT_TABLE_WU_INPROG);
+ //$cStat->setDbParams(STAT_DB_HOST, STAT_DB_USER, STAT_DB_PW, STAT_DB_NAME);
+ $cStat->setShouldDebug(FALSE);
+ $cChart=new Chart(900, 300);
+ $cChart->iXTextPosAdjust=-25;
+ $cChart->sYPosition='right';
+ $cChart->sPrintYValue='normal';
+
+ // number of unsent wus for the last 14 days -->
+ //  common
+ $aItems=$cStat->getLastItemsAfterNowMinus(3600*24*14);
+ if (!($cChart->iYTextFilter=round(count($aItems)/10)))
+	$cChart->iYTextFilter=1;
+ foreach ($aItems as $aItem)
+	$cChart->aItems[]=array(x=>$aItem['date'], y=>round($aItem['value'],1));
+ $cChart->sYName='Workunits';
+ $cChart->writeToFile(SZDGSTAT_OUTPUT_DIR . '/wu_inprogress14day.jpg');
+ // <--
+
+ $cChart->destroy();
+?>
diff --git a/debian/html/szdg-stat/chart_wu_total.php b/debian/html/szdg-stat/chart_wu_total.php
new file mode 100644
index 0000000..40e82ff
--- /dev/null
+++ b/debian/html/szdg-stat/chart_wu_total.php
@@ -0,0 +1,52 @@
+#! /usr/bin/env php
+<?php
+/*
+ * chart_wu_total.php
+ * by Marosi Attila Csaba <atisu at sztaki dot hu>
+ * June 14, 2006
+ *
+ * This is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * To view the GNU Lesser General Public License visit
+ * http://www.gnu.org/copyleft/lesser.html
+ * or write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ *
+ */
+
+ require_once 'include/config.inc.php';
+ require_once 'include/class/chart.class.php';
+ require_once 'include/utilities.inc.php';
+ require_once 'include/class/stat.class.php';
+
+ // common stuff
+ $cStat=new Stat(STAT_TABLE_WU_TOTAL);
+ //$cStat->setDbParams(STAT_DB_HOST, STAT_DB_USER, STAT_DB_PW, STAT_DB_NAME);
+ $cStat->setShouldDebug(FALSE);
+ $cChart=new Chart(900, 300);
+ $cChart->iXTextPosAdjust=-25;
+ $cChart->sYPosition='right';
+ $cChart->sPrintYValue='normal';
+
+ // number of total wus for the last 14 days -->
+ //  common
+ $aItems=$cStat->getLastItemsAfterNowMinus(3600*24*14);
+ if (!($cChart->iYTextFilter=round(count($aItems)/10)))
+	$cChart->iYTextFilter=1;
+ foreach ($aItems as $aItem)
+	$cChart->aItems[]=array(x=>$aItem['date'], y=>round($aItem['value'],1));
+ $cChart->sYName='Workunits';
+ $cChart->writeToFile(SZDGSTAT_OUTPUT_DIR . '/wu_total14day.jpg');
+ // <--
+
+ $cChart->destroy();
+?>
diff --git a/debian/html/szdg-stat/chart_wu_unsent.php b/debian/html/szdg-stat/chart_wu_unsent.php
new file mode 100644
index 0000000..9744827
--- /dev/null
+++ b/debian/html/szdg-stat/chart_wu_unsent.php
@@ -0,0 +1,52 @@
+#! /usr/bin/env php
+<?php
+/*
+ * chart_wu_unsent.php
+ * by Marosi Attila Csaba <atisu at sztaki dot hu>
+ * June 14, 2006
+ *
+ * This is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * To view the GNU Lesser General Public License visit
+ * http://www.gnu.org/copyleft/lesser.html
+ * or write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ *
+ */
+
+ require_once 'include/config.inc.php';
+ require_once 'include/class/chart.class.php';
+ require_once 'include/utilities.inc.php';
+ require_once 'include/class/stat.class.php';
+
+ // common stuff
+ $cStat=new Stat(STAT_TABLE_WU_UNSENT);
+ //$cStat->setDbParams(STAT_DB_HOST, STAT_DB_USER, STAT_DB_PW, STAT_DB_NAME);
+ $cStat->setShouldDebug(FALSE);
+ $cChart=new Chart(900, 300);
+ $cChart->iXTextPosAdjust=-25;
+ $cChart->sYPosition='right';
+ $cChart->sPrintYValue='normal';
+
+ // number of unsent wus for the last 14 days -->
+ //  common
+ $aItems=$cStat->getLastItemsAfterNowMinus(3600*24*14);
+ if (!($cChart->iYTextFilter=round(count($aItems)/10)))
+	$cChart->iYTextFilter=1;
+ foreach ($aItems as $aItem)
+	$cChart->aItems[]=array(x=>$aItem['date'], y=>round($aItem['value'],1));
+ $cChart->sYName='Workunits';
+ $cChart->writeToFile(SZDGSTAT_OUTPUT_DIR . '/wu_unsent14day.jpg');
+ // <--
+
+ $cChart->destroy();
+?>
diff --git a/debian/html/szdg-stat/include/class/chart.class.php b/debian/html/szdg-stat/include/class/chart.class.php
new file mode 100644
index 0000000..e13453b
--- /dev/null
+++ b/debian/html/szdg-stat/include/class/chart.class.php
@@ -0,0 +1,323 @@
+<?php
+/*
+ * chart.class.php
+ * by Marosi Attila Csaba <atisu at sztaki dot hu>
+ * March 26, 2006
+ *
+ * This is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * To view the GNU Lesser General Public License visit
+ * http://www.gnu.org/copyleft/lesser.html
+ * or write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ *
+ */
+
+require_once 'include/strfunc.inc.php';
+require_once 'include/utilities.inc.php';
+
+class Chart {
+    // size of the whole picture
+    var $iWidth;
+    var $iHeight;
+    //// number of items on the x/y
+    //var $iXNOI;
+    //var $iYNOI;
+    // the items on the x/y [ array of strings]
+    var $aItems;
+    // the gd image object
+    var $oImage;
+    // the rectangle used for drawing the graph
+    var $iGWidth;
+    var $iGHeight;
+    // top left corner
+    var $iGTX;
+    var $iGTY;
+    // bottom right corner
+    var $iGBX;
+    var $iGBY;
+    // name of the Y-Axis
+    var $sYName;
+    // adjustment (+-) of the names on the X-Axis
+    var $iXTextPosAdjust;
+    // Position of the Y-Axis ( 'left'/ 'right')
+    var $sYPosition;
+    // every $iXTextFilter th peak will be printed
+    var $iYTextFilter;
+    // title of the chart;
+    var $sTitle;
+    // ????
+    var $sPrintYValue;
+    // colors
+    var $oCBlack;
+    var $oCGrey1;
+    var $oCGrey2;
+    var $oCGrey3;
+    var $oCGrey4;
+    var $oCWhite;
+    var $oCIntRec;
+    var $oCChart;
+    var $oCChartWE;
+    var $oCYText;
+    var $oCBG;
+    // linestyles
+    var $aLineStyle1;
+    var $aLineStyle2;
+    var $aLineStyle3;
+    // how sould the size of one unit on the X-Axis calculated
+    // 'time': (timestamp(latest_item)-timestamp(earliest_item))/($this->iGBX-$this->iGTX)
+    // 'normal': ($this->iGBX-$this->iGTX)/number_of_items
+    var $sSizeOfUnitXCalcMethod;
+
+    function Chart( $iWidth, $iHeight) {
+		$this->iWidth=numerizeString($iWidth);
+		$this->iHeight=numerizeString($iHeight);
+		$this->sYPosition='left';
+		$this->sPrintYValue='normal';
+		$this->iYTextFilter=1;
+		$this->sSizeOfUnitXCalcMethod='normal';
+		// allocate image
+		$this->oImage=imagecreatetruecolor($this->iWidth, $this->iHeight+20);
+		// allocate colors
+		$this->oCBlack=imagecolorallocate($this->oImage, 0, 0, 0);
+		$this->oCGrey1=imagecolorallocate($this->oImage, 0xF8, 0xF8, 0xF8);
+		$this->oCGrey2=imagecolorallocate($this->oImage, 0x81, 0x81, 0x81);
+		$this->oCGrey3=imagecolorallocate($this->oImage, 0x31, 0x31, 0x31);
+		$this->oCGrey4=imagecolorallocate($this->oImage, 0xEE, 0xEE, 0xEE);
+		$this->oCWhite=imagecolorallocate($this->oImage, 0xFF, 0xFF, 0xFF);
+		$this->oCIntRec=imagecolorallocate($this->oImage, 0xC5, 0xD5, 0xFF);
+		$this->oCChart=imagecolorallocate($this->oImage, 0x55, 0x65, 0xC1);
+		$this->oCChartWE=imagecolorallocate($this->oImage, 0x81, 0x81, 0xC1);
+		$this->oCYText=imagecolorallocate($this->oImage, 0x00, 0x00, 0x00);
+		$this->oCBG=imagecolorallocate($this->oImage, 0xC5, 0xD5, 0xFF);
+        // set linestyles
+		$this->aLineStyle1=array($this->oCGrey3, $this->oCGrey4, $this->oCGrey4);
+		$this->aLineStyle2=array($this->oCWhite);
+		$this->aLineStyle3=array($this->oCGrey4, $this->oCGrey4, $this->oCBlack);
+    }
+
+	// draws the chart,
+	//  but first it fills the background
+	function draw() {
+		// fill the background
+		imagefilledrectangle($this->oImage, 0, 0, $this->iWidth, $this->iHeight+20,
+			$this->oCBG);
+		// internal not-so-grey rectangle: this will be used for the graph
+		$this->iGTX=30;
+		$this->iGTY=30;
+		$this->iGBX=$this->iWidth-55;
+		$this->iGBY=$this->iHeight-31;
+		if ($this->sYPosition=='left')
+			imagefilledrectangle($this->oImage, $this->iGTX, $this->iGTY-5, $this->iGBX+5,
+				$this->iGBY, $this->oCIntRec);
+		else
+			imagefilledrectangle($this->oImage, $this->iGTX-5, $this->iGTY-5, $this->iGBX,
+				$this->iGBY, $this->oCIntRec);
+		// the highest value in the array ( x field)
+		// division by zero problem if iMaxY==0
+		$iMaxY=1;
+		foreach ($this->aItems as $aItem) {
+		  if ($aItem['y']>$iMaxY)
+			$iMaxY=$aItem['y'];
+		}
+		// draw the Y-Axis
+		if ( strcmp( $this->sYPosition, 'left') == 0)
+			$iYAxisXPos=30;
+		else
+			$iYAxisXPos=$this->iWidth-55;
+		imageline($this->oImage, $iYAxisXPos, 10, $iYAxisXPos, $this->iHeight-20,
+			$this->oCGrey2);
+		imageline($this->oImage, $iYAxisXPos, 10, $iYAxisXPos, $this->iHeight-21,
+			$this->oCGrey3);
+		imageline($this->oImage, $iYAxisXPos-1, 10, $iYAxisXPos-1, $this->iHeight-20,
+			$this->oCGrey2);
+		imageline($this->oImage, $iYAxisXPos+1, 10, $iYAxisXPos+1, $this->iHeight-20,
+			$this->oCGrey2);
+		imagefilledarc($this->oImage, $iYAxisXPos, 5, 40, 30, 75, 105, $this->oCGrey3,
+			IMG_ARC_CHORD);
+		// draw the X-Axis
+		// TODO: arrow on both sides
+		imageline($this->oImage, 20, $this->iHeight-29, $this->iWidth-35, $this->iHeight-29,
+			$this->oCGrey2);
+		imageline($this->oImage, 20, $this->iHeight-30, $this->iWidth-35, $this->iHeight-30,
+			$this->oCGrey2);
+		imageline($this->oImage, 21, $this->iHeight-30, $this->iWidth-35, $this->iHeight-30,
+			$this->oCGrey3);
+		imageline($this->oImage, 20, $this->iHeight-31, $this->iWidth-35, $this->iHeight-31,
+			$this->oCGrey2);
+		imagefilledarc($this->oImage, $this->iWidth-30, $this->iHeight-30, 30, 40, 165, 195,
+			$this->oCGrey3, IMG_ARC_CHORD);
+		reset($this->aItems);
+		// print the name above the Y-Axis
+		if ($this->sYPosition=='left')
+			imagestring($this->oImage, 2, 33, -3, $this->sYName, $this->oCBlack);
+		else
+			imagestring($this->oImage, 2, $this->iGBX-3-(strlen($this->sYName)*6),
+				-3, $this->sYName, $this->oCBlack);
+		// print the title
+		if ($this->sTitle)
+			imagestring($this->oImage, 5, ($this->iWidth-strlen($this->sTitle)*8)/2, 2,
+				$this->sTitle, $this->oCBlack);
+		// count the size of one unit on the Y-Axis
+		if (($iItemCount=count($this->aItems))<=0)
+			 $iItemCount=1;
+		$iSizeOfUnitY=($this->iGBY-$this->iGTY)/$iMaxY;
+		// TODO: the size SizeOfUnitX should be calculated based upon the elapsed time
+		//       between the first and last item, now it is calculated with the number of
+		//       available elements
+		if ($this->sSizeOfUnitXCalcMethod=='normal') {
+			$iSizeOfUnitX=($this->iGBX-$this->iGTX)/$iItemCount;
+			// draw the chart -->
+			// a seperate polygon for each value. it allows to use different colors
+			//  for different dates
+			for ($iCounter=0; $iCounter<=$iItemCount-1; $iCounter++) {
+				// bottom
+				$aLine[]=$this->iGTX+round($iCounter*$iSizeOfUnitX);
+				$aLine[]=$this->iGBY;
+				// the current value
+				$aLine[]=round($iSizeOfUnitX*$iCounter+$this->iGTX);
+				$aLine[]=round($this->iGBY-$this->aItems[$iCounter]['y']*$iSizeOfUnitY);
+				// the next value
+				$aLine[]=round($iSizeOfUnitX*($iCounter+1)+$this->iGTX);
+				$aLine[]=round($this->iGBY-$this->aItems[$iCounter]['y']*$iSizeOfUnitY);
+				// bottom again
+				$aLine[]=$this->iGTX+round(($iCounter+1)*$iSizeOfUnitX);
+				$aLine[]=$this->iGBY;
+				// draw it, but with different colors for weekdays and for the weekend
+				if (isWeekend($this->aItems[$iCounter]['x']) &&
+					((isWeekend($this->aItems[$iCounter+1]['x']) ||
+					(!isset($this->aItems[$iCounter+1]['x'])))) )
+					imagefilledpolygon($this->oImage, $aLine, 4, $this->oCChartWE);
+				else
+					imagefilledpolygon($this->oImage, $aLine, 4, $this->oCChart);
+				// clean up
+				unset($aLine);
+			}
+			// <--
+		}
+		// horizontal dotted lines and the corresponding values
+		imagesetstyle($this->oImage, $this->aLineStyle1);
+		$iLineInc=($this->iGBY-$this->iGTY)/2;
+		for ($iTemp=1; $this->iGBY-$iTemp*$iLineInc>=$this->iGTY-5; $iTemp++) {
+				imageline($this->oImage, $this->iGTX, ($this->iGBY)-$iTemp*$iLineInc,
+					$this->iGBX, ($this->iGBY)-$iTemp*$iLineInc, IMG_COLOR_STYLED);
+				if ( $this->sYPosition == 'left') {
+					imagestring($this->oImage,
+						    2,
+							$this->iGBX+7,
+							($this->iGBY)-$iTemp*$iLineInc,
+							round( $iMaxY/(3-$iTemp), 3),
+							$this->oCBlack);
+				} else {
+					imagestring( $this->oImage,
+							2,
+							$this->iGTX-10,
+							($this->iGBY)-$iTemp*$iLineInc,
+							round( $iMaxY/(3-$iTemp), 3),
+							$this->oCBlack);
+				}
+		}
+		$iCounter=0;
+		$iDrawCounter=0;
+		$iLastValue=0;
+		foreach ($this->aItems as $aItem) {
+			// print values to the top of each peak
+			$aNextValue=next($this->aItems);
+			$iNextValue=$aNextValue['y'];
+			// printing values routines for 'normal' and 'maxmin' are the same
+			//  just the conditions differ
+		    if ((($this->sPrintYValue=='normal') &&
+				 (($iCounter % $this->iYTextFilter==0) ||
+				 (count($this->aItems)-1==$iCounter))) ||
+				// conditions for 'maxmin'
+				(($this->sPrintYValue=='maxmin') &&
+			     ((($iLastValue < $aItem['y']) && ($iNextValue < $aItem['y'])) ||
+				 (($iLastValue > $aItem['y']) && ($iNextValue > $aItem['y']))))) {
+				// draw vertical dotted lines
+				// do not print the last line
+				if ($this->aItems[count($this->aItems)-1]['y'] != $aItem['y']) {
+					imagesetstyle($this->oImage, $this->aLineStyle3);
+					imageline($this->oImage,
+					   round($iSizeOfUnitX*$iCounter+$this->iGTX),
+					   round($this->iGBY-$aItem['y']*$iSizeOfUnitY),
+					   round($iSizeOfUnitX*$iCounter+$this->iGTX),
+					   $this->iGBY,
+					   IMG_COLOR_STYLED);
+					// print values for the X-Axis
+					// do not print the last value
+					imagestring($this->oImage,
+							3,
+							round($iSizeOfUnitX*$iCounter+$this->iGTX-3),
+							round($this->iGBY-$aItem['y']*$iSizeOfUnitY-12),
+							$aItem['y'],
+							$this->oCYText);
+				}
+				$iItemXCounter=0;
+				// print the timestamp at the bottom
+				// first the day and month, then the hour and minute
+				imagestring($this->oImage,
+					2,
+					round($iSizeOfUnitX*$iCounter+$this->iGTX+5+
+							$this->iXTextPosAdjust),
+					round($this->iGBY+6+(1-($iCounter % 2))*count($aItem['x'])*10),
+					date('M j', $aItem['x']),
+					$this->oCBlack);
+				imagestring( $this->oImage,
+					2,
+					round($iSizeOfUnitX*$iCounter+$this->iGTX+5+
+							$this->iXTextPosAdjust),
+					round($this->iGBY+6+(1-($iCounter % 2))*count($aItem['x'])*10+11),
+					date('G:i', $aItem['x']),
+					$this->oCBlack);
+				$iDrawCounter++;
+			 }
+			 $iCounter++;
+			 $iLastValue = $aItem['y'];
+		}
+		// print the last value next to the Y-Axis
+		if ($this->sYPosition=='right')
+			imagestring($this->oImage, 3,
+				round($iSizeOfUnitX*$iCounter+$this->iGTX+10),
+				round($this->iGBY-$aItem['y']*$iSizeOfUnitY-16),
+				$iLastValue,
+				$this->oCYText);
+		// TODO: print the last value next to the Y-Axis if sYPosition=='left'
+	}
+
+	function dump() {
+		imagejpeg($this->oImage, "", 100);
+	}
+
+	function reset() {
+		unset($this->aItems);
+	}
+
+	function destroy() {
+		imagedestroy($this->oImage);
+	}
+
+	function writeToFile($sFilename) {
+		$this->draw();
+		ob_start();
+		$this->dump();
+		$sJpeg=ob_get_contents();
+		ob_end_clean();
+		if (!($oHandle=fopen($sFilename, "w+"))) {
+			echo "could not open ". $sFilename. " for writing";
+		} else {
+			fwrite($oHandle, $sJpeg);
+			fclose($oHandle);
+		}
+	}
+
+}
+?>
diff --git a/debian/html/szdg-stat/include/class/debug.class.php b/debian/html/szdg-stat/include/class/debug.class.php
new file mode 100644
index 0000000..35c7a13
--- /dev/null
+++ b/debian/html/szdg-stat/include/class/debug.class.php
@@ -0,0 +1,83 @@
+<?php
+/*
+ *
+ * debug.inc.php
+ * by MAROSI Attila Csaba <atisu at su dot co dot hu>
+ * 20031027
+ *
+ * This is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * To view the GNU Lesser General Public License visit
+ * http://www.gnu.org/copyleft/lesser.html
+ * or write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+
+
+Class Debug
+{
+    var $bShouldDebug_;
+    var $sErrorMsg_;
+
+    function Debug()
+    {
+        $this->bShouldDebug_  = FALSE;
+    }
+
+    function getErrorMsg()
+    {
+        return $this->sErrorMsg_;
+    }
+
+    function setErrorMsg_($sMessage)
+    {
+        $this->sErrorMsg_  = $sMessage;
+    }
+
+    function shouldDebug()
+    {
+        return $this->bShouldDebug_;
+    }
+
+    function setShouldDebug($bShouldDebug)
+    {
+        $this->bShouldDebug_    = $bShouldDebug;
+    }
+
+    function getShouldDebug()
+    {
+        return $this->bShouldDebug_;
+    }
+
+    function dieNow_($sMessage = "", $sErrorMsg = "")
+    {
+        $this->setErrorMsg_($sErrorMsg);
+        if ( $this->shouldDebug() )
+        {
+            die($sMessage);
+        }
+        else
+        {
+            die();
+        }
+        return TRUE;
+    }
+
+    function warnNow_($sMessage, $sErrorMsg = "")
+    {
+        $this->setErrorMsg_($sErrorMsg);
+        if ( $this->shouldDebug() )
+            printf("%s", $sMessage);
+        return TRUE;
+    }
+}
+?>
diff --git a/debian/html/szdg-stat/include/class/displayhosts.class.php b/debian/html/szdg-stat/include/class/displayhosts.class.php
new file mode 100644
index 0000000..f13bf8f
--- /dev/null
+++ b/debian/html/szdg-stat/include/class/displayhosts.class.php
@@ -0,0 +1,154 @@
+<?
+
+include_once 'include/rrd_utils.inc.php';
+include_once 'include/strfunc.inc.php';
+require_once 'include/class/sqlfunc.class.php';
+
+define("OTHER_HOSTS", "Other/ private hosts");
+
+Class DisplayHosts {
+
+  var $aNetworks;
+  var $aHostClasses;
+
+  /**
+   *  Constructor
+   *  @param $aNetworks array key: host class, value: network mask.
+   *  @returns nothing
+   */
+  function DisplayHosts($aNetworks) {
+    $this->aNetworks = $aNetworks;
+    $this->aHostClasses = Array();
+  }
+
+
+  function add($sIp, $sImageFile, $aResult) {
+    if (!is_array($this->aNetworks))
+      return FALSE;
+    $sIpAddr = str_pad(decbin(my_ip2long($sIp)), 32, "0", STR_PAD_LEFT);
+    foreach ($this->aNetworks as $sName_ => $aDomains_) {
+      foreach ($aDomains_ as $sDomain_) {
+	$sNetwork = explode("/", $sDomain_);
+	$sNetAddr = str_pad(decbin(my_ip2long($sNetwork[0])), 32, "0", STR_PAD_LEFT);
+	$sCidr = $sNetwork[1];
+	if (!strcmp(substr($sNetAddr, 0, $sCidr), substr($sIpAddr, 0, $sCidr))) {
+	  $this->aHostClasses[$sName_][] = array("image" => $sImageFile, "result" => $aResult);
+	  return TRUE;
+	}
+      }
+    }
+    $this->aHostClasses[OTHER_HOSTS][] =
+      array("image" => $sImageFile, "result" => $aResult);;
+    return TRUE;
+  }
+
+  function calcTotalCreditByClass() {
+    $oSqlFunc = new SqlFunc();
+    $oSqlFunc->connectDb();
+    foreach ($this->aNetworks as $sName_ => $aDomains_) {
+      $aQueryWhere_ = Array();
+      foreach ($aDomains_ as $sDomain_) {
+	$aNetwork = explode("/", $sDomain_);
+	$aQueryWhere_[] = "(INET_ATON(last_ip_addr) >= INET_ATON('". sanitizeString($aNetwork[0]). "') AND ".
+	  "INET_ATON(last_ip_addr) < (INET_ATON('". sanitizeString($aNetwork[0]). "') + (1 << ". (32-numerizeString($aNetwork[1]))." )))";
+      }
+      $sQueryWhere = implode(" OR ", $aQueryWhere_);
+      $sQuery = "SELECT SUM(total_credit) AS credit FROM host WHERE ". $sQueryWhere;
+      $aRow = $oSqlFunc->fetchRow($sQuery);
+      $aReturn[sanitizeString($sName_)] = round($aRow['credit']);
+      $iCredit += round($aRow['credit'], 2);
+    }
+    ksort($aReturn);
+    $sQuery = "SELECT SUM(total_credit) AS credit FROM host";
+    $aRow = $oSqlFunc->fetchRow($sQuery);
+    $aReturn[OTHER_HOSTS] = round($aRow['credit'] - $iCredit);
+    $aReturn['Total'] = round($aRow['credit']);
+    return $aReturn;
+  }
+
+  function printPageCredit($sFile) {
+    $aCredits = $this->calcTotalCreditByClass();
+    // --> duplicate code
+    $iHostsTotal = 0;
+    if (is_array($this->aHostClasses)) {
+      foreach ($this->aHostClasses as $sKey => $aHostClass) {
+	$iHostsTotal += count($aHostClass);
+      }
+    }
+    // <--
+    ob_start();
+    ?>
+    <div class="credit">
+      <table>
+	 <tr>
+	 <th>Institute</th>
+	 <th>Active hosts</th>
+	 <th>Total credit (including active and inactive hosts)</th>
+	 <th>Percent of total credit</th>
+	 </tr>
+	 <?
+	 foreach ($aCredits as $sName_ => $iCredit_) {
+	   $fTotal = floatval($aCredits['Total']);
+	   $fPrecent = ($fTotal<=0?"0":number_format(round($iCredit_/$fTotal*100, 2),2));
+	   echo "<tr style='". ($sName_ == "Total" ? 'background-color: #F5CACA;' : ''  ). "'>";
+	   echo "<td >". $sName_. "</td>".
+	     "<td  style='text-align: right;'>". ($sName_ == "Total" ? $iHostsTotal : count($this->aHostClasses[$sName_])). "</td>".
+	     "<td style='text-align: right;'>". $iCredit_. "</td>".
+	     "<td style='text-align: right;'>". $fPercent. "%</td>";
+	   echo "</tr>";
+											}
+	?>
+         </table>
+	 </div>
+	 <ul>
+	     <li><strong>Institute</strong>: name of institute donating resources (hosts).</li>
+	     <li><strong>Active hosts</strong>: number of hosts active (contacting the server) for the last 14 days.</li>
+	     <li><strong>Total credit</strong>: sum of the credit granted to all resources (regardless of its current status - active or inactive) of the given institute. </li>
+	 </ul>
+	<?
+    $sText = ob_get_clean();
+    file_put_contents($sFile, $sText);
+  }
+
+
+  function printPage($sFile) {
+    $aHostsBy = array();
+    $iHostsTotal = 0;
+    if (is_array($this->aHostClasses)) {
+      ksort($this->aHostClasses);
+      foreach ($this->aHostClasses as $sKey => $aHostClass) {
+	$aHostsBy[]= "<a class=\"hostclass\" href=\"#". sanitizeString($sKey). "\">".
+	  sanitizeString($sKey). "</a> (". count($aHostClass). ")";
+	$iHostsTotal += count($aHostClass);
+      }
+    }
+    $sHostsBy = implode(", ", $aHostsBy);
+
+    ob_start();
+    ?>
+           <b><?=$iHostsTotal?></b> active hosts total. <?if (!empty($aHostsBy)):?>Hosts are provided by: <? echo $sHostsBy; endif?>
+    <?
+    if (is_array($this->aHostClasses)) {
+      foreach ($this->aHostClasses as $sKey => $aHostClass) {
+	?>
+	<div class="section">
+	    <h1><a class="named" name="<?=sanitizeString($sKey)?>"><?=sanitizeString($sKey)?></a></h1>
+            <?
+            foreach ($aHostClass as $aHost) {
+	      echo "<img src=\"stats/". $aHost["image"]. "\"/>\n";
+            }
+	    ?>
+	</div>
+	<?
+      }
+    }
+    ?>
+	      <div class="footer">Last generated: <?=date("r")?></div>
+    <?
+    $sText = ob_get_clean();
+    file_put_contents($sFile, $sText);
+  }
+
+}
+
+?>
diff --git a/debian/html/szdg-stat/include/class/sqlfunc.class.php b/debian/html/szdg-stat/include/class/sqlfunc.class.php
new file mode 100644
index 0000000..7daf560
--- /dev/null
+++ b/debian/html/szdg-stat/include/class/sqlfunc.class.php
@@ -0,0 +1,340 @@
+<?php
+/*
+ *
+ * sqlfunc.class.php
+ * by MAROSI Attila Csaba <atisu at su dot co dot hu>
+ * Dec 5, 2006
+ *
+ * This is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * To view the GNU Lesser General Public License visit
+ * http://www.gnu.org/copyleft/lesser.html
+ * or write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ *
+ * modified for szdg-stat: connectDb() closeDb()
+ *
+ */
+
+
+require_once("include/strfunc.inc.php");
+require_once("debug.class.php");
+require_once("../inc/db.inc");
+
+Class SqlFunc extends Debug
+{
+
+    var $oSqlConnection_;
+    var $sSqlDb_;
+    var $sSqlHost_;
+    var $sSqlUser_;
+    var $sSqlPassword_;
+    var $sSqlType_;
+
+    function SqlFunc()
+    {
+        Debug::Debug();
+    }
+
+    function setSqlConnection_($oSqlConnection)
+    {
+        $this->oSqlConnection_  = $oSqlConnection;
+    }
+
+    function getSqlConnection_()
+    {
+        return $this->oSqlConnection_;
+    }
+
+    function setSqlDb_($sSqlDb)
+    {
+        $this->sSqlDb_  = $sSqlDb;
+    }
+
+    function getSqlDb_()
+    {
+        return $this->sSqlDb_;
+    }
+
+    function setSqlHost_($sSqlHost)
+    {
+        $this->sSqlHost_  = $sSqlHost;
+    }
+
+    function getSqlHost_()
+    {
+        return $this->sSqlHost_;
+    }
+
+    function setSqlUser_($sSqlUser)
+    {
+        $this->sSqlUser_  = $sSqlUser;
+    }
+
+    function getSqlUser_()
+    {
+        return $this->sSqlUser_;
+    }
+
+    function setSqlPassword_($sSqlPassword)
+    {
+        $this->sSqlPassword_  = $sSqlPassword;
+    }
+
+    function getSqlPassword_()
+    {
+        return $this->sSqlPassword_;
+    }
+
+    function setSqlType_($sSqlType)
+    {
+        $this->sSqlType_  = $sSqlType;
+    }
+
+    function getSqlType_()
+    {
+        return $this->sSqlType_;
+    }
+
+    function setDbParams($sHost, $sUser, $sPassword, $sDb, $sType = "mysql")
+    {
+        $this->warnNow_("SqlFunc::setDbParams has been called<br/>");
+        $this->setErrorMsg_("");
+        $this->setSqlDb_($sDb);
+        $this->setSqlHost_($sHost);
+        $this->setSqlUser_($sUser);
+        $this->setSqlPassword_($sPassword);
+        $this->setSqlType_($sType);
+        return TRUE;
+    }
+
+    function closeDb()
+    {
+        //mysql_close($this->oSqlConnection_);
+    }
+
+    function connectDb()
+    {
+	/*
+        $this->setErrorMsg_("");
+        $this->oSqlConnection_ = mysql_connect($this->getSqlHost_(),
+                                                $this->getSqlUser_(),
+                                                $this->getSqlPassword_()) or
+            $this->dieNow_("SqlFunc->connectDb(): could not connect to server:".
+                                mysql_error());
+        mysql_select_db($this->getSqlDb_()) or
+            $this->dieNow_("SqlFunc->connectDb(): could not select database(". $this->getSqlDb_().
+                            "):".
+                            mysql_error());
+        */
+	if (db_init_aux())
+	    $this->dieNow_("SqlFunc->connectDb(): could not open database: " .
+			                                mysql_error());
+
+    }
+
+    function fetchRow($sQuery, $sId = "", $bShouldDie = FALSE )
+    {
+        $this->setErrorMsg_("");
+        if ( ( $oResult = $this->doQuery($sQuery, $sId, $bShouldDie) ) ==
+                FALSE )
+        {
+            $this->warnNow_("SqlFunc->fetchRow()[1][".$sId."]: mysql error:".
+                                mysql_error(). "<br/>");
+            if ( $bShouldDie )
+                $this->dieNow_();
+            return FALSE;
+        }
+        $this->warnNow_("SqlFunc->fetchRow()[2]: ". $sQuery. "<br/>");
+        if ( ( $aRow  = mysql_fetch_array($oResult) ) == FALSE )
+        {
+            $this->warnNow_ ("SqlFunc->fetchRow()[3][". $sId. "]: mysql error:".
+                                mysql_error(). "<br/>");
+            if ( $bShouldDie )
+                $this->dieNow_();
+        }
+        return $aRow;
+    }
+
+    function fetchArray($oResult)
+    {
+        if ( ( $aArray = mysql_fetch_array($oResult) ) == FALSE )
+        {
+            $this->warnNow_("SqlFunc->fetchArray(): mysql error:". mysql_error().
+                             "<br/>");
+            return FALSE;
+        }
+        return $aArray;
+    }
+
+    function fetchArrayResults($sQuery, $sId = "", $bShouldDie = FALSE)
+    {
+        if ( ( $oResult = $this->doQuery($sQuery, $sId, $bShouldDie) ) ==
+                FALSE )
+        {
+            $this->warnNow_("SqlFunc->fetchArrayResults()[1][".$sId."]: mysql error:".
+                                mysql_error(). "<br/>");
+            if ( $bShouldDie )
+                $this->dieNow_();
+            // :-)
+            return FALSE;
+        }
+        while ( ( $aRow = $this->fetchArray($oResult, MYSQL_BOTH) ) == TRUE )
+        {
+            $aReturn[] = $aRow;
+        }
+        return $aReturn;
+    }
+
+    function doQuery($sQuery, $sId = "", $bShouldDie = FALSE )
+    {
+        $this->setErrorMsg_("");
+        if ( strstr($sQuery, "UPDATE") != FALSE)
+            $this->warnNow_("SqlFunc->doQuery(): <b>".$sQuery."</b><br/>");
+        else
+            $this->warnNow_("SqlFunc->doQuery(): ".$sQuery."<br/>");
+        $oResult    = mysql_query($sQuery);
+        if ( $oResult == FALSE )
+        {
+            $this->warnNow_("SqlFunc->doQuery()[".$sId."]: mysql error:".
+                                mysql_error(). "<br/>");
+            if ( $bShouldDie )
+                $this->dieNow_();
+        }
+        return $oResult;
+    }
+
+	function doInsert($sTable, $aArray) {
+		if (!is_array($aArray))
+			return FALSE;
+		$sSqlQ = "INSERT INTO ". sanitizeString($sTable). " ";
+		$sNames = "(";
+		$sValues = " VALUES (";
+		$iCounter = 1;
+		$iSize = count($aArray);
+		// implode?
+		foreach( $aArray as $sKey => $sValue) {
+			$sNames .= sanitizeString($sKey);
+			$sValues .= "'". /*sanitizeString(*/$sValue/*)*/. "'";
+			if ($iCounter != $iSize) {
+				$sNames .= ", ";
+				$sValues .= ", ";
+			}
+			$iCounter++;
+		}
+		$sNames .= ")";
+		$sValues .= ")";
+		$sSqlQ .= $sNames. $sValues;
+		$oResult = $this->doQuery($sSqlQ);
+		if ($oResult != FALSE) {
+			return mysql_insert_id();
+		} else {
+			return FALSE;
+		}
+	}
+
+
+	function doUpdate($sTable, $aArray, $sIdField="id", $iId)
+	{
+		if (!is_array($aArray))
+			return FALSE;
+		$sSqlQ = "UPDATE ". sanitizeString($sTable). " SET ";
+		foreach($aArray as $sKey => $sValue) {
+			$aSet[]= sanitizeString($sKey). "=\"". sanitizeString($sValue). "\"";
+		}
+		// ...
+		$sSqlQ .= implode(", ", $aSet);
+		$sSqlQ .= " WHERE ". sanitizeString($sIdField). "=". numerizeString($iId). " LIMIT 1";
+		return $this->doQuery($sSqlQ);
+	}
+
+
+	/*
+	 *
+	 */
+
+    function insertRelCore_($sTableName, $sField1, $sField2, $iId1, $iId2)
+    {
+        $this->connectDb();
+        $oResult = $this->doQuery("INSERT INTO ". sanitizeString($sTableName).
+			" (". sanitizeString($sField1). ",".
+			sanitizeString($sField2). ") ". "VALUES (\"". numerizeString($iId1). "\",\"".
+			numerizeString($iId2). "\")");
+        $this->closeDb();
+        return $oResult;
+    }
+
+	function deleteRelCore_($sTableName, $sField1, $sField2, $iId1, $iId2)
+	{
+        $this->connectDb();
+        $oResult = $this->doQuery("DELETE FROM ". sanitizeString($sTableName). " WHERE ".
+            sanitizeString($sField1). "=". numerizeString($iId1). " AND ".
+			sanitizeString($sField2). "=".
+            numerizeString($iId2). " LIMIT 1");
+        $this->closeDb();
+        return $oResult;
+	}
+
+    function deleteRelAllCore_($sTableName, $sField, $iId)
+    {
+        $this->connectDb();
+        $oResult = $this->doQuery("DELETE FROM ". sanitizeString($sTableName). " WHERE ".
+            sanitizeString($sField). "=". numerizeString($iId));
+        $this->closeDb();
+        return $oResult;
+    }
+
+	function getLatestCore_($sSelectField, $sTableName, $sOrderBy, $iStart, $iCount, $sWhere = "")
+	{
+        $this->connectDb();
+		$sQuery = "SELECT ". sanitizeString($sSelectField). " FROM ".
+			sanitizeString($sTableName);
+		if ($sWhere != "") {
+			$sQuery .= " WHERE ". sanitizeString($sWhere). " ";
+		}
+		$sQuery .= " ORDER BY ". sanitizeString($sOrderBy).
+			" LIMIT ". numerizeString($iStart). ", ". numerizeString($iCount);
+		$aResults = $this->fetchArrayResults($sQuery);
+        $this->closeDb();
+		return $aResults;
+	}
+
+	function getCountCore_($sTableName, $sWhere="")
+	{
+        $this->connectDb();
+		$sSqlQ="SELECT COUNT(*) FROM ". sanitizeString($sTableName);
+		if ($sWhere != "") {
+			$sSqlQ .= " WHERE ". sanitizeString($sWhere);
+		}
+		$aRow = $this->fetchRow($sSqlQ);
+        $this->closeDb();
+		return $aRow[0];
+	}
+
+	// you can use single quotes in $sWhere
+	function getAllCore_($sTableName, $sOrderBy="", $sWhere="")
+	{
+        $this->connectDb();
+		$sSqlQ="SELECT * FROM ". sanitizeString($sTableName);
+		if ($sWhere != "") {
+			$sSqlQ .= " WHERE ". sanitizeString($sWhere, REP_ENT_SQUOT);
+		}
+		if ($sOrderBy != "") {
+			$sSqlQ .= " ORDER BY ". sanitizeString($sOrderBy);
+		}
+		$aResults = $this->fetchArrayResults($sSqlQ);
+        $this->closeDb();
+		return $aResults;
+	}
+
+}
+?>
diff --git a/debian/html/szdg-stat/include/class/stat.class.php b/debian/html/szdg-stat/include/class/stat.class.php
new file mode 100644
index 0000000..7b479bc
--- /dev/null
+++ b/debian/html/szdg-stat/include/class/stat.class.php
@@ -0,0 +1,96 @@
+<?php
+/*
+ * stat.class.php
+ * by Marosi Attila Csaba <atisu at sztaki dot hu>
+ * Feb 27, 2006
+ *
+ * This is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * To view the GNU Lesser General Public License visit
+ * http://www.gnu.org/copyleft/lesser.html
+ * or write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * uses a table named $TableName:
+ * ------------------------------
+ *
+ * int(16)     value
+ * timestamp   date
+ *
+ */
+
+require_once 'include/strfunc.inc.php';
+require_once 'sqlfunc.class.php';
+
+class Stat extends SqlFunc {
+
+	var $sTableName;
+	//var $sDbName;
+
+	function Stat( /*$sDbName,*/ $sTableName) {
+		$this->sTableName = sanitizeString( $sTableName);
+		//$this->sDbName = sanitizeString( $sDbName);
+	}
+
+	/*
+	 *  creates the table in the given database ( lazyness...)
+	 */
+	function createTable() {
+		$this->connectDb();
+		$oResult = $this->doQuery("CREATE TABLE ". $this->sTableName. " ( value float, date int(32) )" );
+		return $oResult;
+	}
+
+	/*
+	 * inserts a single item into $sTableName with the current timestamp
+	 */
+	function insertItem( $iValue) {
+		$this->connectDb();
+		$oResult = $this->doQuery("INSERT INTO ". $this->sTableName. " values ('".
+			$iValue."', UNIX_TIMESTAMP() )");
+		return $oResult;
+	}
+
+	/*
+	 *  gets the last ( sorted by date) $iCount entries from $sTableName
+	 */
+	function getLastItems( $iCount) {
+		$this->connectDb();
+		$oResult= $this->doQuery("SELECT * FROM ". $this->sTableName." ORDER BY date DESC LIMIT ". numerizeString( $iCount));
+		if ( $oResult == FALSE )
+            return FALSE;
+        while ( $aRow = $this->fetchArray($oResult) )
+        {
+            $aReturn[]  = $aRow;
+        }
+        return $aReturn;
+	}
+
+	function getQuery( $sQuery) {
+		$this->connectDb();
+		$oResult= $this->doQuery( $sQuery);
+		if ( $oResult == FALSE )
+            return FALSE;
+        while ( $aRow = $this->fetchArray($oResult) )
+        {
+            $aReturn[]  = $aRow;
+        }
+        return $aReturn;
+	}
+
+	function getLastItemsAfterNowMinus($sSeconds) {
+		return $this->getQuery('SELECT * FROM '. $this->sTableName. ' WHERE '.
+			'date>=UNIX_TIMESTAMP()-'. sanitizeString($sSeconds, REP_NOT_BRACKET).
+			' ORDER BY date');
+	}
+
+}
+?>
diff --git a/debian/html/szdg-stat/include/config.inc.php b/debian/html/szdg-stat/include/config.inc.php
new file mode 100644
index 0000000..8b972bd
--- /dev/null
+++ b/debian/html/szdg-stat/include/config.inc.php
@@ -0,0 +1,34 @@
+<?php
+/*
+ * config.inc.php
+ * by Marosi Attila Csaba <atisu at sztaki hu>
+ * March 26, 2006
+ *
+ * This is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * To view the GNU Lesser General Public License visit
+ * http://www.gnu.org/copyleft/lesser.html
+ * or write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+
+define('SZDGSTAT_OUTPUT_DIR', '../user/performance');
+
+// table names for the different collected statistics
+define('STAT_TABLE_PERF', 'szdg_stat_performance');
+define('STAT_TABLE_USERS', 'szdg_stat_numofusers');
+define('STAT_TABLE_HOSTS', 'szdg_stat_numofhosts');
+define('STAT_TABLE_WU_INPROG', 'szdg_stat_wuinprog');
+define('STAT_TABLE_WU_TOTAL', 'szdg_stat_wutotal');
+define('STAT_TABLE_WU_UNSENT', 'szdg_stat_wuunsent');
+
+?>
diff --git a/debian/html/szdg-stat/include/rrd_utils.inc.php b/debian/html/szdg-stat/include/rrd_utils.inc.php
new file mode 100644
index 0000000..364ffb3
--- /dev/null
+++ b/debian/html/szdg-stat/include/rrd_utils.inc.php
@@ -0,0 +1,44 @@
+<?php
+/*
+ * rrd_utils.inc.php
+ * by Marosi Attila Csaba <atisu at su dot co dot hu>
+ * December 11, 2008
+ *
+ * This is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * To view the GNU Lesser General Public License visit
+ * http://www.gnu.org/copyleft/lesser.html
+ * or write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+
+$sRrdDir = "rrd/";
+$sImageDir = "../ops/stats/";
+
+
+function writeLog($sMsg) {
+    echo date("c"). ": ". $sMsg. "\n";
+}
+
+function execRrd($sCmd) {
+    //writeLog($sCmd);
+    return system($sCmd);
+}
+
+
+function my_ip2long($sIp) {
+  if (is_numeric($sIp))
+    return sprintf("%u", floatval($sIp));
+  return sprintf("%u", floatval(ip2long($sIp)));
+}
+
+?>
diff --git a/debian/html/szdg-stat/include/stat.inc.php b/debian/html/szdg-stat/include/stat.inc.php
new file mode 100644
index 0000000..e6a1944
--- /dev/null
+++ b/debian/html/szdg-stat/include/stat.inc.php
@@ -0,0 +1,57 @@
+<?php
+/*
+ * stat.inc.php
+ * by Marosi Attila Csaba <atisu at sztaki dot hu>
+ * March 26, 2006
+ *
+ * This is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * To view the GNU Lesser General Public License visit
+ * http://www.gnu.org/copyleft/lesser.html
+ * or write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ *
+ */
+
+ require_once 'include/config.inc.php';
+ require_once 'include/class/stat.class.php';
+ require_once 'include/utilities.inc.php';
+ require_once 'include/class/sqlfunc.class.php';
+
+
+ function getData($sQuery) {
+	$cSqlFunc = new SqlFunc();
+	//$cSqlFunc->setDbParams(BOINC_DB_HOST, BOINC_DB_USER, BOINC_DB_PW, BOINC_DB_NAME, "mysql");
+	$cSqlFunc->setShouldDebug(TRUE);
+	$cSqlFunc->connectDb();
+	$cSqlFunc->setShouldDebug(FALSE);
+	$aRow = $cSqlFunc->fetchRow($sQuery);
+	return $aRow[0];
+ }
+
+
+ function insertData($sTableName, $iData) {
+	$cStat = new Stat($sTableName);
+	//$cStat->setDbParams(STAT_DB_HOST, STAT_DB_USER, STAT_DB_PW, STAT_DB_NAME, "mysql");
+	$cStat->setShouldDebug(FALSE);
+	$cStat->createTable();
+	$cStat->insertItem($iData);
+ }
+
+
+function createTextOut( $sFileName, $iData) {
+ $oFile = fopen(SZDGSTAT_OUTPUT_DIR . '/' . $sFileName, 'w+');
+ fwrite($oFile, $iData);
+ fclose($oFile);
+}
+
+?>
diff --git a/debian/html/szdg-stat/include/strfunc.inc.php b/debian/html/szdg-stat/include/strfunc.inc.php
new file mode 100644
index 0000000..c93c272
--- /dev/null
+++ b/debian/html/szdg-stat/include/strfunc.inc.php
@@ -0,0 +1,120 @@
+<?php
+/*
+ *
+ * strfunc.inc.php
+ * by attila csaba marosi <atisu at su dot co dot hu>
+ * 20050823
+ *
+ * This is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * To view the GNU Lesser General Public License visit
+ * http://www.gnu.org/copyleft/lesser.html
+ * or write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+
+if ( !defined("REP_NOT_AMPER") )
+  define("REP_NOT_AMPER",   1);
+if ( !defined("REP_NOT_LT") )
+  define("REP_NOT_LT",      2);
+if ( !defined("REP_NOT_GT") )
+  define("REP_NOT_GT",      4);
+if ( !defined("REP_NOT_BRACKET") )
+  define("REP_NOT_BRACKET", 8);
+// --> ...
+if ( !defined("REP_NOT_QUOT") )
+  define("REP_NOT_QUOT",   16);
+if ( !defined("REP_NOT_SQUOT") )
+  define("REP_NOT_SQUOT",  32);
+// <--
+if ( !defined("REP_NOT_QUOTE") )
+  define("REP_NOT_QUOTE",   16);
+if ( !defined("REP_NOT_SQUOTE") )
+  define("REP_NOT_SQUOTE",  32);
+// --> for backward compatibility
+if ( !defined("REP_ESC_QUOT") )
+  define("REP_ESC_QUOT",   64);
+if ( !defined("REP_ESC_SQUOT") )
+  define("REP_ESC_SQUOT", 128);
+// <--
+// --> ...
+if ( !defined("REP_ENT_QUOT") )
+  define("REP_ESC_QUOT",   64);
+if ( !defined("REP_ENT_SQUOT") )
+  define("REP_ESC_SQUOT", 128);
+// <-- ...
+if ( !defined("REP_ENT_QUOTE") )
+  define("REP_ESC_QUOTE",   64);
+if ( !defined("REP_ENT_SQUOTE") )
+  define("REP_ESC_SQUOTE", 128);
+
+/**
+  * sanitizeString()
+  * $sUrl:   the URL to be sanitized
+  * $iWhatNot: optional, the following values may be used ( OR-ed together):
+  *              REP_NOT_BRACKET:    do not replace brackets ( '(', ')' )
+  *              REP_NOT_AMPER:      do not replace ampersand ( '&' )
+  *              REP_NOT_GT:         do not replace '>'
+  *              REP_NOT_LT:         do not replace '>'
+  *              REP_NOT_SQUOT:      do not replace singlequotes ( '\'' )
+  *              REP_NOT_QUOT:       do not replace quotes ( '\"' )
+  *              REP_ENT_SQUOT:      do not escape, but use html entities for singlequotes ( '\'' )
+  *              REP_ENT_QUOT:       do not escape, but use html entities for quotes ( '\"' )
+  *
+  * Escapes or replaces all special characters in the given String
+  *
+  * Returns: the sanitized string
+  *
+  **/
+function sanitizeString($sStr, $iWhatNot = 0)
+{
+    $sReturn    = $sStr;
+    if ( !($iWhatNot & REP_NOT_AMPER) )
+        $sReturn    = str_replace("&", "&", $sReturn);
+    if ( ( ($iWhatNot & REP_ENT_SQUOT) ) || ( ($iWhatNot & REP_ENT_SQUOTE) ) )
+    {
+        $sReturn    = str_replace("'", "'", $sReturn);
+        $iWhatNot   += REP_NOT_SQUOT;
+    }
+    if ( ( ($iWhatNot & REP_ENT_QUOT) ) || ( ($iWhatNot & REP_ENT_QUOTE) ) )
+    {
+        $sReturn    = str_replace("\"", """, $sReturn);
+        $iWhatNot   += REP_NOT_QUOT;
+    }
+    if ( !($iWhatNot & REP_NOT_BRACKET) )
+    {
+        $sReturn    = str_replace("(", "", $sReturn);
+        $sReturn    = str_replace(")", "", $sReturn);
+    }
+    if ( !($iWhatNot & REP_NOT_GT) )
+        $sReturn    = str_replace(">", ">", $sReturn);
+    if ( !($iWhatNot & REP_NOT_LT) )
+        $sReturn    = str_replace("<", "<", $sReturn);
+    if ( !($iWhatNot & REP_NOT_SQUOT) )
+    {
+        $sReturn    = str_replace("\'", "'", $sReturn);
+        $sReturn    = str_replace("'", "\'", $sReturn);
+    }
+    if ( !($iWhatNot & REP_NOT_QUOT) )
+    {
+        $sReturn    = str_replace("\\\"", "\"", $sReturn);
+        $sReturn    = str_replace("\"", "\\\"", $sReturn);
+    }
+    return $sReturn;
+}
+
+
+function numerizeString( $sStr)
+{
+    return preg_replace("/[^0-9]+/", "", $sStr);
+}
+?>
diff --git a/debian/html/szdg-stat/include/utilities.inc.php b/debian/html/szdg-stat/include/utilities.inc.php
new file mode 100644
index 0000000..79586c8
--- /dev/null
+++ b/debian/html/szdg-stat/include/utilities.inc.php
@@ -0,0 +1,82 @@
+<?php
+/*
+ * utilities.inc.php
+ * by Marosi Attila Csaba <atisu at su dot co dot hu>
+ * March 20, 2006
+ *
+ * This is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * To view the GNU Lesser General Public License visit
+ * http://www.gnu.org/copyleft/lesser.html
+ * or write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+
+function getTimestamp() {
+	return date("YmdHis");
+}
+
+function getHttpVar($sVar) {
+	if(!empty($_REQUEST[$sVar])) {
+	return $_REQUEST[$sVar];
+    } else {
+	return null;
+    }
+}
+
+//converts between 1..29 ( i know it's shit )
+function decToRoman( $iNumber) {
+	$aRomanNumbers[1]='I';
+	$aRomanNumbers[2]='II';
+	$aRomanNumbers[3]='III';
+	$aRomanNumbers[4]='IV';
+	$aRomanNumbers[5]='V';
+	$aRomanNumbers[6]='VI';
+	$aRomanNumbers[7]='VII';
+	$aRomanNumbers[8]='VIII';
+	$aRomanNumbers[9]='IX';
+	$aRomanNumbers[10]='X';
+	$aRomanNumbers[11]='XI';
+	$aRomanNumbers[12]='XII';
+	$aRomanNumbers[13]='XIII';
+	$aRomanNumbers[14]='XIV';
+	$aRomanNumbers[15]='XV';
+	$aRomanNumbers[16]='XVI';
+	$aRomanNumbers[17]='XVII';
+	$aRomanNumbers[18]='XVIII';
+	$aRomanNumbers[19]='XIX';
+	$aRomanNumbers[20]='XX';
+	$aRomanNumbers[21]='XXI';
+	$aRomanNumbers[22]='XXII';
+	$aRomanNumbers[23]='XXIII';
+	$aRomanNumbers[24]='XXIV';
+	$aRomanNumbers[25]='XXV';
+	$aRomanNumbers[26]='XXVI';
+	$aRomanNumbers[27]='XXVII';
+	$aRomanNumbers[28]='XXVIII';
+	$aRomanNumbers[29]='XXIX';
+	if ($iNumber>0)
+		return $aRomanNumbers[$iNumber];
+	else
+		return -1;
+}
+
+function isWeekend($iTimestamp) {
+	$iDayOfWeek=date('w', $iTimestamp);
+	// is it sunday or saturday ?
+	if (($iDayOfWeek==0) || ($iDayOfWeek==6) )
+		return true;
+	else
+		return false;
+}
+
+?>
diff --git a/debian/html/szdg-stat/rrd_host.php b/debian/html/szdg-stat/rrd_host.php
new file mode 100644
index 0000000..d5203a1
--- /dev/null
+++ b/debian/html/szdg-stat/rrd_host.php
@@ -0,0 +1,117 @@
+#! /usr/bin/env php
+<?php
+/*
+ * rrd_host.php
+ * by Marosi Attila Csaba <atisu at sztaki dot hu>
+ * December 11, 2008
+ *
+ * This is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * To view the GNU Lesser General Public License visit
+ * http://www.gnu.org/copyleft/lesser.html
+ * or write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ *
+ */
+require_once 'include/class/sqlfunc.class.php';
+require_once 'include/class/displayhosts.class.php';
+include_once 'include/utilities.inc.php';
+include_once 'include/rrd_utils.inc.php';
+include_once 'rrd_config.inc';
+
+// upper limit of the y-axis;
+$iUpperLimit = 50;
+// count host only with activity NOW()-$iActivityPeriod
+$iActivityPeriod = 3600*24*7;
+$iTime = round(time(), -1);
+// select only those host that were active in the last week
+$sQuery= "SELECT
+	    expavg_credit,
+	    host.id AS hostid,
+	    domain_name,
+	    last_ip_addr AS ip,
+	    SUM( IF(server_state=4, 1, 0)) AS rcount
+	  FROM host
+	  LEFT JOIN result ON
+	    host.id=result.hostid
+	  WHERE
+	    rpc_time > UNIX_TIMESTAMP(NOW())-". $iActivityPeriod. "
+	  GROUP BY host.host_cpid";
+$sQueryActivity = "SELECT
+		     domain_name,
+		     host.id as hostid,
+		     last_ip_addr as ip,
+		     MAX(rpc_time)
+		   FROM host
+		   WHERE
+		     rpc_time > UNIX_TIMESTAMP(NOW())-". $iActivityPeriod. "
+		   GROUP BY host_cpid";
+
+$oSqlFunc = new SqlFunc();
+$oSqlFunc->connectDb();
+
+if ($argv[1] == "graph") {
+    $aResults = $oSqlFunc->fetchArrayResults($sQueryActivity);
+    writeLog("removing old graphs");
+    execRrd("rm -rf ". $sImageDir. "1week_host_*.png");
+    execrrd("rm -rf ". $sImageDir. "31days_host_*.png");
+
+    $oDHWeek = new DisplayHosts($aClasses);
+    $oDHMonth = new DisplayHosts($aClasses);
+
+} else {
+    $aResults = $oSqlFunc->fetchArrayResults($sQuery);
+}
+
+if (is_array($aResults)) {
+    foreach($aResults as $aResult) {
+	$sFilename = "host_". str_pad($aResult['hostid'], 6, "0", PAD_RIGHT);
+	$sRrdPath = $sRrdDir. $sFilename. ".rrd";
+	if (!is_file($sRrdPath)) {
+	    writeLog( "creating RRD (". $sRrdPath. ")");
+	    // feed interval: 1800 sec, heartbeat: 4500 sec, number of rows: 4464
+	    execRrd("rrdtool create ". $sRrdPath. " --start ". $iTime. " --step 1800 DS:date:GAUGE:4500:U:U DS:expavgcredit:GAUGE:4500:U:U RRA:AVERAGE:0.5:1:4464");
+	} else {
+	    // either generate graph or update data
+	    if ($argv[1] == "graph") {
+
+		// 1 week diagrams
+		$sImagePath = $sImageDir. "1week_". $sFilename. ".png";
+		writeLog("creating graph (". $sImagePath. ")");
+		execRrd("rrdtool graph --start now-604800 --end now -u ". $iUpperLimit. " -t \"". $aResult['domain_name']. " // ".
+			$aResult['ip']. " - last 1 week\" ". $sImagePath. " DEF:timestamp=". $sRrdPath. ":date:AVERAGE DEF:expavgcredit=". $sRrdPath. ":expavgcredit:AVERAGE ".
+			" LINE2:timestamp#FF0000:\"Number of work units on the client\" LINE2:expavgcredit#0000FF:\"Granted credit per second for the client, recent average\"");
+		$oDHWeek->add($aResult['ip'], "1week_". $sFilename. ".png", $aResult);
+
+		// 1 month diagrams
+		$sImagePath = $sImageDir. "31days_". $sFilename. ".png";
+		writeLog("creating graph (". $sImagePath. ")");
+		execRrd("rrdtool graph --start now-2678400 --end now -u ". $iUpperLimit. " -t \"". $aResult['domain_name']. " // ".
+		      $aResult['ip']. " - last 31 days\" ". $sImagePath. " DEF:timestamp=". $sRrdPath. ":date:AVERAGE DEF:expavgcredit=". $sRrdPath. ":expavgcredit:AVERAGE ".
+			" LINE2:timestamp#FF0000:\"Number of work units on the client\" LINE2:expavgcredit#0000FF:\"Granted credit per second for the client, recent average\"");
+		$oDHMonth->add($aResult['ip'],  "31days_". $sFilename. ".png", $aResult);
+
+	    } else {
+		writeLog("updating RRD (". $sRrdPath. ")");
+		execRrd("rrdtool update ". $sRrdPath. " ". $iTime. ":". $aResult['rcount']. ":". $aResult['expavg_credit']);
+	    }
+	}
+    }
+    if ($argv[1] == "graph") {
+      $oDHMonth->printPage($sImageDir. "show_hosts_31days.html");
+      $oDHWeek->printPage($sImageDir. "show_hosts_1week.html");
+      $oDHWeek->printPageCredit($sImageDir. "credit_stats.html");
+    }
+}
+
+
+writeLog("done updating");
diff --git a/debian/html/szdg-stat/rrd_result.php b/debian/html/szdg-stat/rrd_result.php
new file mode 100644
index 0000000..1e16e66
--- /dev/null
+++ b/debian/html/szdg-stat/rrd_result.php
@@ -0,0 +1,69 @@
+#! /usr/bin/env php
+<?php
+/*
+ * rrd_result.php
+ * by Marosi Attila Csaba <atisu at sztaki dot hu>
+ * December 11, 2008
+ *
+ * This is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * To view the GNU Lesser General Public License visit
+ * http://www.gnu.org/copyleft/lesser.html
+ * or write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ *
+ */
+
+require_once 'include/class/sqlfunc.class.php';
+include_once 'include/utilities.inc.php';
+include_once 'include/rrd_utils.inc.php';
+
+$iTime = round(time(), -1);
+$oSqlFunc = new SqlFunc();
+$oSqlFunc->connectDb();
+// Inprogress results
+$sQueryInprogress = "select count(*) from result where server_state=4";
+$aResult = $oSqlFunc->fetchRow($sQueryInprogress);
+$iInprogress = $aResult[0];
+// Inprogress and unsent results
+$sQueryNotFinished = "select count(*) from result where server_state=4 or server_state=2";
+$aResult = $oSqlFunc->fetchRow($sQueryNotFinished);
+$iNotFinished = $aResult[0];
+
+$sFilename = "results.rrd";
+$sRrdPath = $sRrdDir. $sFilename;
+if (!is_file($sRrdPath)) {
+    writeLog( "creating RRD (". $sRrdPath. ")");
+    // feed interval: 1800 sec, heartbeat: 4500 sec, number of rows: 4464
+    execRrd("rrdtool create ". $sRrdPath. " --start ". $iTime. " --step 1800 DS:inprogress:GAUGE:4500:U:U DS:notfinished:GAUGE:4500:U:U RRA:AVERAGE:0.5:1:4464");
+} else {
+    // either generate graph or update data
+    if ($argv[1] != "graph") {
+	writeLog("updating RRD (". $sRrdPath. ")");
+	execRrd("rrdtool update ". $sRrdPath. " ". $iTime. ":". $iInprogress. ":". $iNotFinished);
+    } else {
+	writelog("creating graph (". $sImagePath. ")");
+	$sImagePath = $sImageDir. "1week_results.png";
+	execRrd("rrdtool graph --start now-604800 --end now --width 900 --height 250 -t \"Total number of work units and number of being processed work units - last 1 week\" ".
+		$sImagePath. " DEF:inprogress=". $sRrdPath. ":inprogress:AVERAGE DEF:notfinished=".
+		$sRrdPath. ":notfinished:AVERAGE LINE2:notfinished#FF0000:\"Number of work units on the server\" ".
+		"LINE2:inprogress#0000FF:\"Number of work units on the server being processed\"");
+	$sImagePath = $sImageDir. "31days_results.png";
+	execRrd("rrdtool graph --start now-2678400 --end now --width 900 --height 250 -t \"Total number of work units and number of being processed work units - last 31 days\" ".
+		$sImagePath. " DEF:inprogress=". $sRrdPath. ":inprogress:AVERAGE DEF:notfinished=".
+		$sRrdPath. ":notfinished:AVERAGE LINE2:notfinished#FF0000:\"Number of work units on the server\" ".
+		"LINE2:inprogress#0000FF:\"Number of work units on the server being processed\"");
+    }
+}
+
+writeLog("done updating");
+
diff --git a/debian/html/szdg-stat/sample_rrd_config.inc b/debian/html/szdg-stat/sample_rrd_config.inc
new file mode 100644
index 0000000..fee20f9
--- /dev/null
+++ b/debian/html/szdg-stat/sample_rrd_config.inc
@@ -0,0 +1,15 @@
+<?php
+
+global $aClasses;
+
+$aClasses = Array();
+/*
+// examples:
+$aClasses["SZTAKI"] = Array("192.168.144.0/24",
+			"192.168.132.0/24",
+			"192.168.237.129/32",
+			"192.168.218.128/32",
+			"127.0.0.1/32");
+$aClasses["AMRI"] = Array("10.104.10.0/24");
+*/
+?>
diff --git a/debian/html/szdg-stat/stat_hosts.php b/debian/html/szdg-stat/stat_hosts.php
new file mode 100644
index 0000000..bc6ac08
--- /dev/null
+++ b/debian/html/szdg-stat/stat_hosts.php
@@ -0,0 +1,35 @@
+#! /usr/bin/env php
+<?php
+/*
+ * stat_hosts.php
+ * by Marosi Attila Csaba <atisu at sztaki dot hu>
+ * June 14, 2006
+ *
+ * This is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * To view the GNU Lesser General Public License visit
+ * http://www.gnu.org/copyleft/lesser.html
+ * or write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ *
+ */
+
+ require_once 'include/stat.inc.php';
+
+ $sQuery="SELECT COUNT(*) FROM host where total_credit >= 0.001";
+ $sFileName="hosts.txt";
+
+ // ----- do the magic
+ $iData=getData($sQuery);
+ insertData(STAT_TABLE_HOSTS, $iData);
+ createTextOut($sFileName, $iData);
+?>
diff --git a/debian/html/szdg-stat/stat_performance.php b/debian/html/szdg-stat/stat_performance.php
new file mode 100644
index 0000000..cc12b75
--- /dev/null
+++ b/debian/html/szdg-stat/stat_performance.php
@@ -0,0 +1,39 @@
+#! /usr/bin/env php
+<?php
+/*
+ * stat_performance.php
+ * by Marosi Attila Csaba <atisu at sztaki dot hu>
+ * March 26, 2006
+ *
+ * This is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * To view the GNU Lesser General Public License visit
+ * http://www.gnu.org/copyleft/lesser.html
+ * or write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ *
+ */
+
+ require_once 'include/stat.inc.php';
+
+ $sQuery = "SELECT SUM(h.p_fpops * r.cpu_time) / 172800 ".
+    "FROM result r LEFT JOIN host h ON r.hostid = h.id ".
+    "WHERE received_time > UNIX_TIMESTAMP()-172800";
+ $sFileName = "performance48.txt";
+
+ // ----- do the magic
+ $iData = round( getData($sQuery) * 1E-9, 3);
+ insertData(STAT_TABLE_PERF, $iData);
+ createTextOut($sFileName, $iData);
+
+?>
+
diff --git a/debian/html/szdg-stat/stat_users.php b/debian/html/szdg-stat/stat_users.php
new file mode 100644
index 0000000..df113f4
--- /dev/null
+++ b/debian/html/szdg-stat/stat_users.php
@@ -0,0 +1,38 @@
+#! /usr/bin/env php
+<?php
+/*
+ * stat_users.php
+ * by Marosi Attila Csaba <atisu at sztaki dot hu>
+ * March 21, 2006
+ *
+ * This is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * To view the GNU Lesser General Public License visit
+ * http://www.gnu.org/copyleft/lesser.html
+ * or write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ *
+ */
+
+ require_once 'include/stat.inc.php';
+
+ $sQuery="SELECT COUNT(*) FROM user";
+ $sFileName="users.txt";
+
+ // ----- do the magic
+ $iData=getData($sQuery);
+ insertData(STAT_TABLE_USERS, $iData);
+ createTextOut($sFileName, $iData);
+
+?>
+
+
diff --git a/debian/html/szdg-stat/stat_wu_inprogress.php b/debian/html/szdg-stat/stat_wu_inprogress.php
new file mode 100644
index 0000000..912c7a5
--- /dev/null
+++ b/debian/html/szdg-stat/stat_wu_inprogress.php
@@ -0,0 +1,33 @@
+#! /usr/bin/env php
+<?php
+/*
+ * stat_wu_inprogress.php
+ * by Marosi Attila Csaba <atisu at sztaki dot hu>
+ * March 21, 2006
+ *
+ * This is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * To view the GNU Lesser General Public License visit
+ * http://www.gnu.org/copyleft/lesser.html
+ * or write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ *
+ */
+
+ require_once 'include/stat.inc.php';
+
+ $sQuery="SELECT COUNT(*) FROM result WHERE server_state=4";
+
+ // ----- do the magic
+ $iData=getData($sQuery);
+ insertData(STAT_TABLE_WU_INPROG, $iData);
+?>
diff --git a/debian/html/szdg-stat/stat_wu_total.php b/debian/html/szdg-stat/stat_wu_total.php
new file mode 100644
index 0000000..dd64d3b
--- /dev/null
+++ b/debian/html/szdg-stat/stat_wu_total.php
@@ -0,0 +1,33 @@
+#! /usr/bin/env php
+<?php
+/*
+ * stat_wu_total.php
+ * by Marosi Attila Csaba <atisu at sztaki dot hu>
+ * March 21, 2006
+ *
+ * This is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * To view the GNU Lesser General Public License visit
+ * http://www.gnu.org/copyleft/lesser.html
+ * or write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ *
+ */
+
+ require_once 'include/stat.inc.php';
+
+ $sQuery="SELECT COUNT(*) FROM result";
+
+ // ----- do the magic
+ $iData=getData($sQuery);
+ insertData(STAT_TABLE_WU_TOTAL, $iData);
+?>
diff --git a/debian/html/szdg-stat/stat_wu_unsent.php b/debian/html/szdg-stat/stat_wu_unsent.php
new file mode 100644
index 0000000..4bd36d2
--- /dev/null
+++ b/debian/html/szdg-stat/stat_wu_unsent.php
@@ -0,0 +1,35 @@
+#! /usr/bin/env php
+<?php
+/*
+ * stat_wu_unsent.php
+ * by Marosi Attila Csaba <atisu at sztaki dot hu>
+ * March 21, 2006
+ *
+ * This is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * To view the GNU Lesser General Public License visit
+ * http://www.gnu.org/copyleft/lesser.html
+ * or write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ *
+ */
+
+ require_once 'include/stat.inc.php';
+
+ $sQuery="SELECT COUNT(*) FROM result WHERE server_state=2";
+ $sFileName="wu_unsent.txt";
+
+ // ----- do the magic
+ $iData=getData($sQuery);
+ insertData(STAT_TABLE_WU_UNSENT, $iData);
+ createTextOut($sFileName, $iData);
+?>

-- 
BOINC packaging



More information about the pkg-boinc-commits mailing list