diff -uNr lms.orig/bin/lms-updatewarnings lms/bin/lms-updatewarnings
--- lms.orig/bin/lms-updatewarnings	1970-01-01 01:00:00.000000000 +0100
+++ lms/bin/lms-updatewarnings	2004-01-30 13:49:39.000000000 +0100
@@ -0,0 +1,152 @@
+#!/usr/bin/perl -Tw
+#
+# LMS version 1.1-cvs
+#
+#  (C) 2001-2004 LMS Developers
+#
+#  Please, see the doc/AUTHORS for more information about authors!
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License Version 2 as
+#  published by the Free Software Foundation.
+#
+#  This program 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 General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+#  USA.
+#
+
+use strict;
+use DBI;
+use Config::IniFiles;
+use Getopt::Long;
+use vars qw($configfile $quiet $help $version);
+use POSIX qw(strftime);
+
+sub u32todotquad($)
+{
+        my $p = shift @_;
+        return sprintf "%d.%d.%d.%d", ($p>>24)&0xff,($p>>16)&0xff, ($p>>8)&0xff,$p&0xff;
+}
+
+my $_version = '1.1-cvs';
+
+my %options = (
+	"--config-file|C=s"	=>	\$configfile,
+	"--quiet|q"		=>	\$quiet,
+	"--help|h"		=>	\$help,
+	"--version|v"		=>	\$version,
+);
+
+Getopt::Long::config("no_ignore_case");
+GetOptions(%options);
+
+if($help)
+{
+	print STDERR <<EOF;
+lms-updatewarnings, version $_version
+(C) 2001-2004 LMS Developers
+
+-C, --config-file=/etc/lms/lms.ini	alternate config file (default: /etc/lms/lms.ini);
+-h, --help			print this help and exit;
+-v, --version			print version info and exit;
+-q, --quiet			suppress any output, except errors;
+
+EOF
+	exit 0;
+}
+
+if($version)
+{
+	print STDERR <<EOF;
+lms-updatewarnings, version $_version
+(C) 2001-2004 LMS Developers
+
+EOF
+	exit 0;
+}
+
+if(!$configfile)
+{
+	$configfile = "/etc/lms/lms.ini";
+}
+
+if(!$quiet)
+{
+	print STDOUT "lms-updatewarnings, version $_version\n";
+	print STDOUT "(C) 2001-2004 LMS Developers\n";
+	print STDOUT "Using file $configfile as config.\n";
+}
+
+if(! -r $configfile)
+{
+	print STDERR "Fatal error: Unable to read configuration file $configfile, exiting.\n";
+	exit 1;
+}
+
+my $ini = new Config::IniFiles -file => $configfile;
+
+my $dbtype = $ini->val('database', 'type') || 'mysql';
+my $dbhost = $ini->val('database', 'host') || 'localhost';
+my $dbuser = $ini->val('database', 'user') || 'root';
+my $dbpasswd = $ini->val('database', 'password') || '';
+my $dbname = $ini->val('database', 'database') || 'lms';
+
+my $limit = $ini->val('warnings', 'limit') || 0;
+
+my $dbase;
+my $utsfmt;
+
+if($dbtype eq "mysql")
+{
+	$dbase = DBI->connect("DBI:mysql:database=$dbname;host=$dbhost","$dbuser","$dbpasswd", { RaiseError => 1 });
+	$utsfmt = "UNIX_TIMESTAMP()";
+}
+elsif($dbtype eq "postgres")
+{
+	$dbase = DBI->connect("DBI:Pg:dbname=$dbname;host=$dbhost","$dbuser","$dbpasswd", { RaiseError => 1 });
+	$utsfmt = "EXTRACT(EPOCH FROM CURRENT_TIMESTAMP(0))";
+}
+else
+{
+	print STDERR "Fatal error: unsupported database type: $dbtype, exiting.\n";
+	exit 1;
+}
+
+my $dbq = $dbase->prepare("SELECT id, lastname, name, email, phone1 FROM users");
+$dbq->execute();
+while (my $row = $dbq->fetchrow_hashref())
+{
+	my $balance = 0;
+	my $sdbq = $dbase->prepare("SELECT SUM(value) AS sum FROM cash WHERE userid='$row->{'id'}' AND type='3'");
+	$sdbq->execute();
+	if(my $srow = $sdbq->fetchrow_hashref())
+	{
+		$balance = $balance + (defined $srow->{'sum'} ? $srow->{'sum'} : 0);
+	}
+	$sdbq = $dbase->prepare("SELECT SUM(value) AS sum FROM cash WHERE userid='$row->{'id'}' AND type='4'");
+	$sdbq->execute();
+	if(my $srow = $sdbq->fetchrow_hashref())
+	{
+		$balance = $balance - (defined $srow->{'sum'} ? $srow->{'sum'} : 0);
+	}
+	if($balance < $limit)
+	{
+		$sdbq = $dbase->prepare("UPDATE nodes SET warning=1 WHERE ownerid='$row->{'id'}'");
+		$sdbq->execute();
+	}
+	
+}
+
+$dbq = $dbase->prepare("DELETE FROM timestamps WHERE tablename = 'nodes' OR tablename = '_global'");
+$dbq->execute();
+$dbq = $dbase->prepare("INSERT INTO timestamps (tablename,time) VALUES ('nodes',$utsfmt)");
+$dbq->execute();
+$dbq = $dbase->prepare("INSERT INTO timestamps (tablename,time) VALUES ('_global',$utsfmt)");
+$dbq->execute();
+$dbase->disconnect();
diff -uNr lms.orig/templates/nodeaddbox.html lms/templates/nodeaddbox.html
--- lms.orig/templates/nodeaddbox.html	2003-12-17 00:18:47.000000000 +0100
+++ lms/templates/nodeaddbox.html	2004-01-30 13:23:27.000000000 +0100
@@ -49,6 +49,20 @@
 	</TR>
 	<TR CLASS="LIGHT">
 		<TD WIDTH="1%" CLASS="FLEFT">
+			<IMG SRC="img/{if ! $nodedata.warning}no{/if}access.gif" BORDER="0" ALT="">
+		</TD>
+		<TD WIDTH="1%" NOWRAP>
+			<B>Ostrze¿enie:</B>
+		</TD>
+		<TD WIDTH="98%" CLASS="FRIGHT">
+			<SELECT SIZE="1" CLASS="BOLD" NAME="nodedata[warning]" {tip text="Ustaw ostrze¿enie komputera"}>
+				<OPTION VALUE="1"{if $nodedata.warning} SELECTED{/if}>w³±czone</OPTION>
+				<OPTION VALUE="0"{if ! $nodedata.warning} SELECTED{/if}>wy³±czone</OPTION>
+			</SELECT>
+		</TD>
+	</TR>
+	<TR CLASS="LIGHT">
+		<TD WIDTH="1%" CLASS="FLEFT">
 			<IMG SRC="img/user.gif" BORDER="0" ALT="W³a¶ciciel:">
 		</TD>
 		<TD WIDTH="1%" NOWRAP>
diff -uNr lms.orig/templates/nodeeditbox.html lms/templates/nodeeditbox.html
--- lms.orig/templates/nodeeditbox.html	2003-12-15 01:47:00.000000000 +0100
+++ lms/templates/nodeeditbox.html	2004-01-30 13:31:14.000000000 +0100
@@ -60,6 +60,17 @@
 	</TR>
 	<TR CLASS="LIGHT">
 		<TD WIDTH="1%" CLASS="FLEFT">
+			<IMG SRC="img/{if ! $nodeinfo.warning}no{/if}access.gif" BORDER="0" ALT="">
+		</TD>
+		<TD WIDTH="99%" CLASS="FRIGHT" COLSPAN="2">
+			<SELECT SIZE="1" CLASS="BOLD" NAME="nodeedit[warning]" {tip text="Ustaw ostrze¿enie komputera"}>
+				<OPTION VALUE="1"{if $nodeinfo.warning} SELECTED{/if}>ostrze¿enie w³±czone</OPTION>
+				<OPTION VALUE="0"{if ! $nodeinfo.warning} SELECTED{/if}>ostrze¿enie wy³±czone</OPTION>
+			</SELECT>
+		</TD>
+	</TR>
+	<TR CLASS="LIGHT">
+		<TD WIDTH="1%" CLASS="FLEFT">
 			<IMG SRC="img/user.gif" BORDER="0" ALT="W³a¶ciciel:">
 		</TD>
 		<TD WIDTH="99%" CLASS="FRIGHT" COLSPAN="2">
diff -uNr lms.orig/templates/nodeinfobox.html lms/templates/nodeinfobox.html
--- lms.orig/templates/nodeinfobox.html	2003-12-15 01:47:00.000000000 +0100
+++ lms/templates/nodeinfobox.html	2004-01-30 13:25:02.000000000 +0100
@@ -65,6 +65,14 @@
 	</TR>
 	<TR CLASS="LIGHT">
 		<TD WIDTH="1%" CLASS="FLEFT">
+			<A HREF="?m=nodewarn&id={$nodeinfo.id}"><IMG SRC="img/{if ! $nodeinfo.warning}no{/if}access.gif" BORDER="0" ALT=""></A>
+		</TD>
+		<TD WIDTH="99%" CLASS="FRIGHT" COLSPAN="2">
+			<B>{if $nodeinfo.warning}ostrze¿enie w³±czone{else}ostrze¿enie wy³aczone{/if}</B>
+		</TD>
+	</TR>
+	<TR CLASS="LIGHT">
+		<TD WIDTH="1%" CLASS="FLEFT">
 			<IMG SRC="img/admins.gif" BORDER="0" ALT="">
 		</TD>
 		<TD WIDTH="1%">
diff -uNr lms.orig/templates/nodelist.html lms/templates/nodelist.html
--- lms.orig/templates/nodelist.html	2003-12-15 22:00:00.000000000 +0100
+++ lms/templates/nodelist.html	2004-01-30 12:50:30.000000000 +0100
@@ -51,6 +51,7 @@
 		<TD class="fright" width="1%">
 			<nobr>
 			<a href="?m=nodeset&id={$nodelist[nodelist].id}"><img src="img/{if ! $nodelist[nodelist].access}no{/if}access.gif" border="0" ALT="{if ! $nodelist[nodelist].access}[ Pod³±cz ]{else}[ Od³±cz ]{/if}"></A>
+			<a href="?m=nodewarn&id={$nodelist[nodelist].id}"><img src="img/{if ! $nodelist[nodelist].warning}no{/if}access.gif" border="0" ALT="{if ! $nodelist[nodelist].warning}[ Ostrzegaj ]{else}[ Nie ostrzegaj ]{/if}"></A>
 			<a href="?m=nodedel&id={$nodelist[nodelist].id}" onClick="return confirmLink(this, 'Jeste¶ pewien ¿e chcesz usun±æ komputer \'{$nodelist[nodelist].name|upper}\' z bazy danych?')"><img src="img/delete.gif" border="0" ALT="[ Usuñ ]"></A>
 			<a href="?m=nodeedit&id={$nodelist[nodelist].id}"><img src="img/edit.gif" border="0" ALT="[ Edytuj ]"></A>
 			<a href="?m=nodeinfo&id={$nodelist[nodelist].id}"><img src="img/info.gif" border="0" ALT="[ Info ]"></A>
diff -uNr lms.orig/templates/userlist.html lms/templates/userlist.html
--- lms.orig/templates/userlist.html	2004-01-13 21:42:48.000000000 +0100
+++ lms/templates/userlist.html	2004-01-30 13:02:56.000000000 +0100
@@ -70,27 +70,31 @@
 		<TD 	{if $userlist[userlist].account}
 				{if $userlist[userlist].status neq 3} 
 					onClick="return self.location.href='?m=userinfo&id={$userlist[userlist].id}';"
-				{else}
-					{if $userlist[userlist].nodeac eq 1} 
-						onClick="return self.location.href='?m=nodeset&ownerid={$userlist[userlist].id}';"
-					{else}
-						{if $userlist[userlist].nodeac eq 2} 
-			    				onClick="return self.location.href='?m=nodeset&ownerid={$userlist[userlist].id}';"
-						{else} 
-							onClick="return self.location.href='?m=nodeset&ownerid={$userlist[userlist].id}&access=1';"
-						{/if}
-					{/if}
 				{/if}
 			{/if} valign="top" align="right">
 			<img src="img/empty.gif" align="absmiddle" width="1" height="16" ALT="" border="0">({$userlist[userlist].id|string_format:"%04d"})<BR>
 			{if $userlist[userlist].account}
 				{if $userlist[userlist].status eq 3}
 					{if $userlist[userlist].nodeac eq 1}
-						<A HREF="?m=nodeset&ownerid={$userlist[userlist].id}"><IMG SRC="img/access.gif" align="absmiddle" ALT="[ Od³±cz wszystkie ]" border="0"></A>
+						<A HREF="?m=nodeset&ownerid={$userlist[userlist].id}"><IMG SRC="img/access.gif" align="absmiddle" ALT="[ Od³±cz wszystkie ]" border="0"></A><BR>
 					{else}
 						{if $userlist[userlist].nodeac eq 2}
-							<A HREF="?m=nodeset&ownerid={$userlist[userlist].id}"><IMG SRC="img/mixaccess.gif" align="absmiddle" ALT="[ Od³±cz wszystkie ]" border="0"></A>
-						{else}<A HREF="?m=nodeset&ownerid={$userlist[userlist].id}&access=1"><IMG SRC="img/noaccess.gif" align="absmiddle" ALT="[ Pod³±cz wszystkie ]" border="0"></A>
+							<A HREF="?m=nodeset&ownerid={$userlist[userlist].id}"><IMG SRC="img/mixaccess.gif" align="absmiddle" ALT="[ Od³±cz wszystkie ]" border="0"></A><BR>
+						{else}<A HREF="?m=nodeset&ownerid={$userlist[userlist].id}&access=1"><IMG SRC="img/noaccess.gif" align="absmiddle" ALT="[ Pod³±cz wszystkie ]" border="0"></A><BR>
+						{/if}
+					{/if}
+				{/if}
+			{else}
+				<IMG src="img/exclamation.gif" align="absmiddle" border="0" ALT="Brak przypisanych komputerów"><BR>
+			{/if}			
+			{if $userlist[userlist].warncount}
+				{if $userlist[userlist].status eq 3}
+					{if $userlist[userlist].nodewarn eq 1}
+						<A HREF="?m=nodewarn&ownerid={$userlist[userlist].id}"><IMG SRC="img/access.gif" align="absmiddle" ALT="[ Nie ostrzegaj ¿adnych ]" border="0"></A>
+					{else}
+						{if $userlist[userlist].nodewarn eq 2}
+							<A HREF="?m=nodewarn&ownerid={$userlist[userlist].id}"><IMG SRC="img/mixaccess.gif" align="absmiddle" ALT="[ Nie ostrzegaj ¿adnych ]" border="0"></A>
+						{else}<A HREF="?m=nodewarn&ownerid={$userlist[userlist].id}&warning=1"><IMG SRC="img/noaccess.gif" align="absmiddle" ALT="[ Ostrzegaj wszystkie ]" border="0"></A>
 						{/if}
 					{/if}
 				{/if}
diff -uNr lms.orig/templates/usernodesbox.html lms/templates/usernodesbox.html
--- lms.orig/templates/usernodesbox.html	2003-12-15 01:47:01.000000000 +0100
+++ lms/templates/usernodesbox.html	2004-01-30 13:13:12.000000000 +0100
@@ -15,6 +15,7 @@
 	<tr bgcolor="{cycle}" {cycle print=false} onmouseover="setPointer(this, '#CCFFCC')" onmouseout="setPointer(this, '{cycle}')"{if ! $usernodes[usernodes].access} class="blend"{/if}>
 		<TD WIDTH="1%" CLASS="FLEFT">
 			<a href="?m=nodeset&id={$usernodes[usernodes].id}"><IMG src="img/{if ! $usernodes[usernodes].access}no{/if}access.gif" ALT="[ {if ! $usernodes[usernodes].access}Pod³±cz{else}Od³±cz{/if} ]" border="0" align="absmiddle"></A>
+			<a href="?m=nodewarn&id={$usernodes[usernodes].id}"><IMG src="img/{if ! $usernodes[usernodes].warning}no{/if}access.gif" ALT="[ {if ! $usernodes[usernodes].warning}Ostrzegaj{else}Nie ostrzegaj{/if} ]" border="0" align="absmiddle"></A>
 		</TD>
 		<TD WIDTH="97%" onClick="return self.location.href='?m=nodeinfo&id={$usernodes[usernodes].id}';">
 			<B>{$usernodes[usernodes].name}</B><BR>
@@ -46,6 +47,8 @@
 		<TD WIDTH="99%" COLSPAN="3" CLASS="FLEFTU">
 			<A HREF="?m=nodeset&ownerid={$usernodes.ownerid}&access=1"><IMG SRC="img/access.gif" ALIGN="ABSMIDDLE" BORDER="0"> Pod³±cz wszystkie</A><BR>
 			<A HREF="?m=nodeset&ownerid={$usernodes.ownerid}"><IMG SRC="img/noaccess.gif" ALIGN="ABSMIDDLE" BORDER="0"> Od³±cz wszystkie</A><BR>
+			<A HREF="?m=nodewarn&ownerid={$usernodes.ownerid}&warning=1"><IMG SRC="img/access.gif" ALIGN="ABSMIDDLE" BORDER="0"> Ostrzegaj wszystkie</A><BR>
+			<A HREF="?m=nodewarn&ownerid={$usernodes.ownerid}"><IMG SRC="img/noaccess.gif" ALIGN="ABSMIDDLE" BORDER="0"> Nie ostrzegaj ¿adnych</A><BR>
 		</TD>
 		<TD WIDTH="1%" CLASS="FRIGHTU" NOWRAP VALIGN="BOTTOM" ALIGN="RIGHT">
 			{if $userinfo.status eq "3" and ! $userinfo.deleted}<A HREF="?m=nodeadd&ownerid={$usernodes.ownerid}">Nowy <IMG SRC="img/edit.gif" ALIGN="ABSMIDDLE" BORDER="0"></A>{else}<FONT CLASS="BLEND">Nowy <IMG SRC="img/edit.gif" ALIGN="ABSMIDDLE">{/if}
diff -uNr lms.orig/templates/usersearchresults.html lms/templates/usersearchresults.html
--- lms.orig/templates/usersearchresults.html	2003-12-17 22:24:31.000000000 +0100
+++ lms/templates/usersearchresults.html	2004-01-30 13:07:51.000000000 +0100
@@ -37,9 +37,10 @@
 			<IMG src="img/phone.gif" ALT="" align="absmiddle" border="0">&nbsp;{$userlist[userlist].phone1}{/if}<BR>
 			<IMG SRC="img/home.gif" ALT="" align="absmiddle" border="0">&nbsp;{$userlist[userlist].address}{if $userlist[userlist].city neq ""},{/if} {$userlist[userlist].zip} {$userlist[userlist].city}
 		</TD>
-		<TD {if $userlist[userlist].status neq 3} onClick="return self.location.href='?m=userinfo&id={$userlist[userlist].id}';"{else}{if $userlist[userlist].nodeac eq 1} onClick="return self.location.href='?m=nodeset&ownerid={$userlist[userlist].id}';"{else}{if $userlist[userlist].nodeac eq 2} onClick="return self.location.href='?m=nodeset&ownerid={$userlist[userlist].id}';"{else} onClick="return self.location.href='?m=nodeset&ownerid={$userlist[userlist].id}&access=1';"{/if}{/if}{/if}valign="top" align="right">
+		<TD {if $userlist[userlist].status neq 3} onClick="return self.location.href='?m=userinfo&id={$userlist[userlist].id}';"{/if} valign="top" align="right">
 			<img src="img/empty.gif" align="absmiddle" width="1" height="16" ALT="" border="">({$userlist[userlist].id|string_format:"%04d"})<BR>
-			{if $userlist[userlist].status eq 3}{if $userlist[userlist].nodeac eq 1}<A HREF="?m=nodeset&ownerid={$userlist[userlist].id}"><IMG SRC="img/access.gif" align="absmiddle" ALT="" border="0"></A>{else}{if $userlist[userlist].nodeac eq 2}<A HREF="?m=nodeset&ownerid={$userlist[userlist].id}"><IMG SRC="img/mixaccess.gif" align="absmiddle" ALT="" border="0"></A>{else}<A HREF="?m=nodeset&ownerid={$userlist[userlist].id}&access=1"><IMG SRC="img/noaccess.gif" align="absmiddle" ALT="" border="0"></A>{/if}{/if}{/if}
+			{if $userlist[userlist].status eq 3}{if $userlist[userlist].nodeac eq 1}<A HREF="?m=nodeset&ownerid={$userlist[userlist].id}"><IMG SRC="img/access.gif" align="absmiddle" ALT="" border="0"></A>{else}{if $userlist[userlist].nodeac eq 2}<A HREF="?m=nodeset&ownerid={$userlist[userlist].id}"><IMG SRC="img/mixaccess.gif" align="absmiddle" ALT="" border="0"></A>{else}<A HREF="?m=nodeset&ownerid={$userlist[userlist].id}&access=1"><IMG SRC="img/noaccess.gif" align="absmiddle" ALT="" border="0"></A>{/if}{/if}{/if}<BR>
+			{if $userlist[userlist].status eq 3}{if $userlist[userlist].nodewarn eq 1}<A HREF="?m=nodewarn&ownerid={$userlist[userlist].id}"><IMG SRC="img/access.gif" align="absmiddle" ALT="" border="0"></A>{else}{if $userlist[userlist].nodewarn eq 2}<A HREF="?m=nodewarn&ownerid={$userlist[userlist].id}"><IMG SRC="img/mixaccess.gif" align="absmiddle" ALT="" border="0"></A>{else}<A HREF="?m=nodewarn&ownerid={$userlist[userlist].id}&warning=1"><IMG SRC="img/noaccess.gif" align="absmiddle" ALT="" border="0"></A>{/if}{/if}{/if}
 		</TD>
 		<TD onClick="return self.location.href='?m=userinfo&id={$userlist[userlist].id}';" valign="top">
 			<IMG src="img/mail.gif" ALT="" align="absmiddle" border="0">&nbsp;{$userlist[userlist].email}<BR>
diff -uNr lms.orig/modules/nodeedit.php lms/modules/nodeedit.php
--- lms.orig/modules/nodeedit.php	2004-01-01 21:45:36.000000000 +0100
+++ lms/modules/nodeedit.php	2004-01-30 12:45:55.000000000 +0100
@@ -110,6 +110,8 @@
 
 	if($nodeedit[access]!=1)
 		$nodeedit[access] = 0;
+	if($nodeedit[warning]!=1)
+		$nodeedit[warning] = 0;
 	
 	if($nodeinfo[netdev] != $nodeedit[netdev] && $nodeedit[netdev] != 0)
 	{
diff -uNr lms.orig/modules/nodewarn.php lms/modules/nodewarn.php
--- lms.orig/modules/nodewarn.php	1970-01-01 01:00:00.000000000 +0100
+++ lms/modules/nodewarn.php	2004-01-30 12:43:27.000000000 +0100
@@ -0,0 +1,40 @@
+<?php
+
+/*
+ * LMS version 1.1-cvs
+ *
+ *  (C) Copyright 2001-2004 LMS Developers
+ *
+ *  Please, see the doc/AUTHORS for more information about authors!
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License Version 2 as
+ *  published by the Free Software Foundation.
+ *
+ *  This program 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 General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ *  USA.
+ *
+ */
+
+if($LMS->UserExists($_GET['ownerid']))
+{
+	$LMS->NodeSetWarnU($_GET['ownerid'], $_GET['warning']);
+	$backid = $_GET['ownerid'];
+}
+
+if($LMS->NodeExists($_GET['id']))
+{
+	$LMS->NodeSetWarn($_GET['id']);
+	$backid = $_GET['id'];
+}
+
+header("Location: ?".$_SESSION[backto]."#".$backid);
+
+?>
diff -uNr lms.orig/lib/LMS.class.php lms/lib/LMS.class.php
--- lms.orig/lib/LMS.class.php	2004-01-25 16:16:02.000000000 +0100
+++ lms/lib/LMS.class.php	2004-01-30 12:37:46.000000000 +0100
@@ -592,6 +592,7 @@
 		{
 			$tariffvalues = $this->DB->GetAllByKey("SELECT users.id AS id, SUM(value) AS value FROM users, assignments, tariffs WHERE users.id = assignments.userid AND tariffs.id = tariffid GROUP by users.id",'id');
 			$access = $this->DB->GetAllByKey("SELECT ownerid AS id, SUM(access) AS acsum, COUNT(access) AS account FROM nodes GROUP BY ownerid",'id');
+			$warning = $this->DB->GetAllByKey("SELECT ownerid AS id, SUM(warning) AS warnsum, COUNT(warning) AS warncount FROM nodes GROUP BY ownerid",'id');
 
 			foreach($userlist as $idx => $row)
 			{
@@ -602,6 +603,12 @@
 					$userlist[$idx]['nodeac'] = 0;
 				else
 					$userlist[$idx]['nodeac'] = 2;
+				if($warning[$row['id']]['warncount'] == $warning[$row['id']]['warnsum'])
+					$userlist[$idx]['nodewarn'] = 1;
+				elseif($warning[$row['id']]['warnsum'] == 0)
+					$userlist[$idx]['nodewarn'] = 0;
+				else
+					$userlist[$idx]['nodewarn'] = 2;
 				if($userlist[$idx]['balance'] > 0)
 					$over += $userlist[$idx]['balance'];
 				elseif($userlist[$idx]['balance'] < 0)
@@ -666,17 +673,25 @@
 			$tariffvalues = $this->DB->GetAllByKey("SELECT users.id AS id, SUM(value) AS value FROM users, assignments, tariffs WHERE users.id = assignments.userid AND tariffs.id = tariffid GROUP by users.id",'id');
 
 			$access = $this->DB->GetAllByKey("SELECT ownerid AS id, SUM(access) AS acsum, COUNT(access) AS account FROM nodes GROUP BY ownerid",'id');
+			$warning = $this->DB->GetAllByKey("SELECT ownerid AS id, SUM(warning) AS warnsum, COUNT(warning) AS warncount FROM nodes GROUP BY ownerid",'id');
 			foreach($userlist as $idx => $row)
 			{
 				$userlist[$idx]['tariffvalue'] = $tariffvalues[$row['id']]['value'];
 				$userlist[$idx]['account'] = $access[$row['id']]['account'];
-				
+				$userlist[$idx]['warncount'] = $warning[$row['id']]['warncount'];
+
 				if($access[$row['id']]['account'] == $access[$row['id']]['acsum'])
 					$userlist[$idx]['nodeac'] = 1;
 				elseif($access[$row['id']]['acsum'] == 0)
 					$userlist[$idx]['nodeac'] = 0;
 				else
 					$userlist[$idx]['nodeac'] = 2;
+				if($warning[$row['id']]['warncount'] == $warning[$row['id']]['warnsum'])
+					$userlist[$idx]['nodewarn'] = 1;
+				elseif($warning[$row['id']]['warnsum'] == 0)
+					$userlist[$idx]['nodewarn'] = 0;
+				else
+					$userlist[$idx]['nodewarn'] = 2;
 					
 				if($userlist[$idx]['balance'] > 0)
 					$over += $userlist[$idx]['balance'];
@@ -715,7 +730,7 @@
 
 	function GetUserNodes($id)
 	{
-		if($result = $this->DB->GetAll("SELECT id, name, mac, ipaddr, inet_ntoa(ipaddr) AS ip, access FROM nodes WHERE ownerid=? ORDER BY name ASC",array($id))){
+		if($result = $this->DB->GetAll("SELECT id, name, mac, ipaddr, inet_ntoa(ipaddr) AS ip, access, warning FROM nodes WHERE ownerid=? ORDER BY name ASC",array($id))){
 			$result['total'] = sizeof($result);
 			$result['ownerid'] = $id;
 		}
@@ -831,7 +846,7 @@
 	function NodeUpdate($nodedata)
 	{
 		$this->SetTS("nodes");
-		return $this->DB->Execute("UPDATE nodes SET name=?, ipaddr=inet_aton(?), mac=?, netdev=?, moddate=?NOW?, modid=?, access=?, ownerid=? WHERE id=?",array(strtoupper($nodedata['name']), $nodedata['ipaddr'], strtoupper($nodedata['mac']), $nodedata['netdev'], $this->SESSION->id, $nodedata['access'], $nodedata['ownerid'], $nodedata['id']));
+		return $this->DB->Execute("UPDATE nodes SET name=?, ipaddr=inet_aton(?), mac=?, netdev=?, moddate=?NOW?, modid=?, access=?, warning=?, ownerid=? WHERE id=?",array(strtoupper($nodedata['name']), $nodedata['ipaddr'], strtoupper($nodedata['mac']), $nodedata['netdev'], $this->SESSION->id, $nodedata['access'], $nodedata['warning'], $nodedata['ownerid'], $nodedata['id']));
 	}
 
 	function DeleteNode($id)
@@ -882,7 +897,7 @@
 
 	function GetNode($id)
 	{
-		if($result = $this->DB->GetRow("SELECT id, name, ownerid, ipaddr, inet_ntoa(ipaddr) AS ip, mac, access, creationdate, moddate, creatorid, modid, netdev FROM nodes WHERE id=?",array($id)))
+		if($result = $this->DB->GetRow("SELECT id, name, ownerid, ipaddr, inet_ntoa(ipaddr) AS ip, mac, access, warning, creationdate, moddate, creatorid, modid, netdev FROM nodes WHERE id=?",array($id)))
 		{
 			$result['createdby'] = $this->GetAdminName($result['creatorid']);
 			$result['modifiedby'] = $this->GetAdminName($result['modid']);
@@ -930,7 +945,7 @@
 			foreach($username as $idx => $row)
 				$usernames[$row['id']] = $row['username'];
 
-		if($nodelist = $this->DB->GetAll("SELECT id, ipaddr,inet_ntoa(ipaddr) AS ip, mac, name, ownerid, access, netdev FROM nodes WHERE ownerid > 0".($sqlord != "" ? $sqlord." ".$direction : "")))
+		if($nodelist = $this->DB->GetAll("SELECT id, ipaddr,inet_ntoa(ipaddr) AS ip, mac, name, ownerid, access, warning, netdev FROM nodes WHERE ownerid > 0".($sqlord != "" ? $sqlord." ".$direction : "")))
 		{
 			foreach($nodelist as $idx => $row)
 			{
@@ -1069,6 +1084,24 @@
 			return $this->DB->Execute("UPDATE nodes SET access=?, modid=? WHERE ownerid=?",array(0,$this->SESSION->id,$id));
 	}		
 
+	function NodeSetWarn($id)
+	{
+		$this->SetTS("nodes");
+		if($this->DB->GetOne("SELECT warning FROM nodes WHERE id=?",array($id)) == 1 )
+			return $this->DB->Execute("UPDATE nodes SET warning=0, modid=? WHERE id=?",array($this->SESSION->id,$id));
+		else
+			return $this->DB->Execute("UPDATE nodes SET warning=1, modid=? WHERE id=?",array($this->SESSION->id,$id));
+	}
+
+	function NodeSetWarnU($id,$warning=FALSE)
+	{
+		$this->SetTS("nodes");
+		if($warning)
+			return $this->DB->Execute("UPDATE nodes SET warning=?, modid=? WHERE ownerid=?",array(1,$this->SESSION->id,$id));
+		else
+			return $this->DB->Execute("UPDATE nodes SET warning=?, modid=? WHERE ownerid=?",array(0,$this->SESSION->id,$id));
+	}		
+
 	function IPSetU($netdev, $access=FALSE)
 	{
 		$this->SetTS("nodes");
@@ -1081,7 +1114,7 @@
 	function NodeAdd($nodedata)
 	{
 		$this->SetTS("nodes");
-		if($this->DB->Execute("INSERT INTO nodes (name, mac, ipaddr, ownerid, creatorid, creationdate, access) VALUES (?, ?, inet_aton(?), ?, ?, ?NOW?, ?)",array(strtoupper($nodedata['name']),strtoupper($nodedata['mac']),$nodedata['ipaddr'],$nodedata['ownerid'],$this->SESSION->id, $nodedata['access'])))
+		if($this->DB->Execute("INSERT INTO nodes (name, mac, ipaddr, ownerid, creatorid, creationdate, access, warning) VALUES (?, ?, inet_aton(?), ?, ?, ?NOW?, ?)",array(strtoupper($nodedata['name']),strtoupper($nodedata['mac']),$nodedata['ipaddr'],$nodedata['ownerid'],$this->SESSION->id, $nodedata['access'], $nodedata['warning'])))
 			return $this->DB->GetOne("SELECT MAX(id) FROM nodes");
 		else
 			return FALSE;
diff -uNr lms.orig/sample/lms.ini lms/sample/lms.ini
--- lms.orig/sample/lms.ini	2003-12-26 20:46:33.000000000 +0100
+++ lms/sample/lms.ini	2004-01-30 13:53:02.000000000 +0100
@@ -384,6 +384,19 @@
 ; limit			= -20
 
 ; ---------------------------------------------------------------------------
+; Konfiguracja lms-updatewarnings - skryptu do ustawiania ostrze¿enia
+; komputerów u¿ytkowników maj±cych bilans poni¿ej zadanego poziomu
+; finansowego.
+; ---------------------------------------------------------------------------
+
+[warnings]
+
+; Limit bilansu poni¿ej którego wszystkie komputery u¿ytkownika bêd±
+; otrzymywaæ ostrze¿enie przez www. Domy¶lnie - 0.
+;
+; limit			= -20
+
+; ---------------------------------------------------------------------------
 ; Konfiguracja lms-makedhcpconf - skryptu do generowania pliku dhcpd.conf
 ; ---------------------------------------------------------------------------
 
diff -uNr lms.orig/doc/UPGRADE.mysql lms/doc/UPGRADE.mysql
--- lms.orig/doc/UPGRADE.mysql	2004-01-11 16:08:44.000000000 +0100
+++ lms/doc/UPGRADE.mysql	2004-01-30 14:02:22.000000000 +0100
@@ -45,6 +45,9 @@
 /* Linki do urz±dzeñ */
 ALTER TABLE nodes ADD netdev INT(11) NOT NULL DEFAULT '0' AFTER modid;
 
+/* Ostrze¿enia */
+ALTER TABLE nodes ADD warning BOOL NOT NULL DEFAULT '0' AFTER access;
+
 /* Zmiana zapisu limitu */
 ALTER TABLE tariffs CHANGE uprate uprate INT(11), 
 		    CHANGE downrate downrate INT(11),
diff -uNr lms.orig/doc/UPGRADE.pgsql lms/doc/UPGRADE.pgsql
--- lms.orig/doc/UPGRADE.pgsql	2004-01-11 16:08:44.000000000 +0100
+++ lms/doc/UPGRADE.pgsql	2004-01-30 14:08:39.000000000 +0100
@@ -83,6 +83,10 @@
 ALTER TABLE nodes ALTER COLUMN netdev SET default 0;
 UPDATE nodes SET netdev = 0;
 ALTER TABLE nodes ALTER COLUMN netdev SET NOT NULL;  	
+/* Ostrze¿enia */
+ALTER TABLE nodes ADD warning int2;
+ALTER TABLE nodes ALTER COLUMN warning SET NOT NULL;
+ALTER TABLE nodes ALTER COLUMN warning SET DEFAULT 0;
 
 /* Zmiana zapisu limitu */
 ALTER TABLE tariffs ALTER uprate DROP NOT NULL;
@@ -91,7 +95,7 @@
 ALTER TABLE tariffs ALTER downrate DROP DEFAULT; 
 ALTER TABLE tariffs ALTER description DROP NOT NULL;
 
-/* Zmiana typów pul numerycznych */
+/* Zmiana typów pól numerycznych */
 ALTER TABLE cash ADD val numeric(9,2);
 UPDATE cash SET val=value;
 ALTER TABLE cash ALTER val SET NOT NULL;
diff -uNr lms.orig/doc/lms.mysql lms/doc/lms.mysql
--- lms.orig/doc/lms.mysql	2004-01-11 15:04:58.000000000 +0100
+++ lms/doc/lms.mysql	2004-01-30 13:58:11.000000000 +0100
@@ -134,6 +134,7 @@
   creatorid INT(11) NOT NULL default '0',
   modid INT(11) NOT NULL default '0',
   access TINYINT(1) NOT NULL default '1',
+  warning TINYINT(1) NOT NULL default '0',
   PRIMARY KEY  (id),
   UNIQUE KEY id_2 (id,name),
   KEY id (id)
diff -uNr lms.orig/doc/lms.pgsql lms/doc/lms.pgsql
--- lms.orig/doc/lms.pgsql	2004-01-11 16:08:44.000000000 +0100
+++ lms/doc/lms.pgsql	2004-01-30 13:58:37.000000000 +0100
@@ -78,6 +78,7 @@
 	creatorid integer NOT NULL,
 	modid integer DEFAULT 0 NOT NULL,
 	access smallint DEFAULT 1 NOT NULL,
+	warning smallint DEFAULT 0 NOT NULL,
 	PRIMARY KEY (id)
 );
 
