diff --git a/checkin_notes b/checkin_notes
index 503477449c..ad4e76aae3 100755
--- a/checkin_notes
+++ b/checkin_notes
@@ -12906,7 +12906,27 @@ David May 31 2004
diagnostics.C
David June 1 2004
+ web stuff:
+ - fix bug in merging > 2 hosts
- remove references to html/forum in setup script
+ - move host_update_credit() to host.inc
+ and make an ops page for updating a host's credit
py/Boinc/
setup_project.py
+
+David June 1 2004
+ - small web fixes related to moving forum files
+ html/
+ inc/
+ forum_show.inc
+ host.inc
+ util.inc
+ ops/
+ host_update_credit.php (new)
+ user/
+ forum_edit.php
+ forum_forum.php
+ forum_user_posts.php
+ host_edit_action.php
+ host_update_credit.php
diff --git a/html/inc/forum_show.inc b/html/inc/forum_show.inc
index 1867d7c55f..398818c333 100644
--- a/html/inc/forum_show.inc
+++ b/html/inc/forum_show.inc
@@ -115,7 +115,7 @@ function show_forum($category, $forum, $start, $sort_style) {
} else {
echo "
", $thread->replies+1, " |
- ", user_links($user, "../"), " |
+ ", user_links($user), " |
", $thread->views, " |
", $x, " |
";
diff --git a/html/inc/host.inc b/html/inc/host.inc
index bbd7ed1594..14ea864171 100644
--- a/html/inc/host.inc
+++ b/html/inc/host.inc
@@ -217,4 +217,39 @@ function hosts_compatible($host1, $host2) {
return true;
}
+function host_update_credit($hostid) {
+ $t = 0;
+ $avg = 0;
+ $now = time();
+ $avg_time = 0;
+ $half_life = 86400*7;
+ $r = mysql_query("select * from result where hostid=$hostid order by received_time");
+ while ($result = mysql_fetch_object($r)) {
+ if ($result->granted_credit <= 0) continue;
+ $t += $result->granted_credit;
+
+ // the following taken from lib/util.C
+ //
+ if ($avg_time) {
+ $diff = $result->received_time - $avg_time;
+ if ($diff <=0) $diff = 3600;
+ $diff_days = $diff/86400;
+ $weight = exp(-$diff*M_LN2/$half_life);
+ $avg *= $weight;
+ $avg += (1-$weight)*($result->granted_credit/$diff_days);
+ } else {
+ $dd = ($result->received_time - $result->sent_time)/86400;
+ $avg = $result->granted_credit/$dd;
+ }
+ $avg_time = $result->received_time;
+ echo "
$avg\n";
+ }
+ mysql_free_result($r);
+
+ $diff = $now - $avg_time;
+ $weight = exp(-$diff*M_LN2/$half_life);
+ $avg *= $weight;
+ mysql_query("update host set total_credit=$t, expavg_credit=$avg where id=$hostid");
+}
+
?>
diff --git a/html/inc/util.inc b/html/inc/util.inc
index 5c01a87da0..5cfe0a7028 100644
--- a/html/inc/util.inc
+++ b/html/inc/util.inc
@@ -433,10 +433,10 @@ function project_is_stopped() {
return file_exists("../stop_servers");
}
-function user_links($user, $dir='') {
- $x = "id>$user->name";
+function user_links($user) {
+ $x = "id>$user->name";
if ($user->has_profile) {
- $x .= " id>
";
+ $x .= " id>
";
}
return $x;
}
diff --git a/html/ops/host_update_credit.php b/html/ops/host_update_credit.php
new file mode 100644
index 0000000000..ad2a29c7a6
--- /dev/null
+++ b/html/ops/host_update_credit.php
@@ -0,0 +1,7 @@
+
+
+require_once("../inc/db.inc");
+require_once("../inc/host.inc");
+
+host_update_credit(141006);
+?>
diff --git a/html/project.sample/project_news.inc b/html/project.sample/project_news.inc
new file mode 100644
index 0000000000..9ef882479a
--- /dev/null
+++ b/html/project.sample/project_news.inc
@@ -0,0 +1,12 @@
+
+
+$project_news = array(
+ array("March 1, 2004",
+ "Sample news item"
+ ),
+ array("March 2, 2004",
+ "Another item"
+ )
+);
+
+?>
diff --git a/html/user/forum_edit.php b/html/user/forum_edit.php
index 433e0d15e8..2661249d15 100644
--- a/html/user/forum_edit.php
+++ b/html/user/forum_edit.php
@@ -51,7 +51,7 @@ if ($logged_in_user->id != $post->user) {
show_forum_title($forum, $thread, $category->is_helpdesk);
-echo "