File: 1.17.7a/server/base/screen.inc.php (View as HTML)

  1: <?php // screen.inc.php -- web page screen library
  2: /* -------------------------------------------------------------
  3: This file is part of FreeNATS
  4: 
  5: FreeNATS is (C) Copyright 2008-2017 PurplePixie Systems
  6: 
  7: FreeNATS is free software: you can redistribute it and/or modify
  8: it under the terms of the GNU General Public License as published by
  9: the Free Software Foundation, either version 3 of the License, or
 10: (at your option) any later version.
 11: 
 12: FreeNATS is distributed in the hope that it will be useful,
 13: but WITHOUT ANY WARRANTY; without even the implied warranty of
 14: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 15: GNU General Public License for more details.
 16: 
 17: You should have received a copy of the GNU General Public License
 18: along with FreeNATS.  If not, see www.gnu.org/licenses
 19: 
 20: For more information see www.purplepixie.org/freenats
 21: -------------------------------------------------------------- */
 22: 
 23: $menu=array();
 24: $menu[0]="<a href=http://www.purplepixie.org/freenats/>".$NATS->Lang->Item("homepage")."</a>";
 25: $menu[1]="<a href=monitor.php>".$NATS->Lang->Item("live.monitor")."</a>&nbsp; &nbsp;<a href=main.php>".$NATS->Lang->Item("configuration")."</a>&nbsp; &nbsp;";
 26: $menu[1].="<a href=http://www.purplepixie.org/freenats/support.php target=top>".$NATS->Lang->Item("help")."</a>&nbsp; &nbsp;<a href=logout.php>".$NATS->Lang->Item("logout")."</a>";
 27: $menu[2]=$menu[1]."&nbsp; &nbsp;<a href=admin.php>Admin</a>";
 28: 
 29: $menu[3]="<a href=iphone.php>".$NATS->Lang->Item("iphone")."</a>&nbsp;  &nbsp;<a href=http://www.purplepixie.org/freenats/>".$NATS->Lang->Item("homepage")."</a>";
 30: /*
 31: $pagemenu['main']="<a href=main.php?mode=overview>Overview</a>&nbsp; &nbsp;<a href=main.php?mode=nodes>Nodes</a>&nbsp; &nbsp;";
 32: $pagemenu['main'].="<a href=main.php?mode=groups>Groups</a>&nbsp; &nbsp;<a href=main.php?mode=views>Views &amp; Reports</a>&nbsp; &nbsp;";
 33: $pagemenu['main'].="<a href=pref.php>User Options</a>";
 34: */
 35: $pagemenu=array();
 36: 
 37: 
 38: $pagemenu['main']=array(
 39: 	array("overview","main.php?mode=overview",$NATS->Lang->Item("overview"), false),
 40: 	array("nodes","main.php?mode=nodes",$NATS->Lang->Item("nodes"), true),
 41: 	array("groups","main.php?mode=groups",$NATS->Lang->Item("groups"), true),
 42: 	array("views","main.php?mode=views",$NATS->Lang->Item("views.reports"), false),
 43: 	array("pref","pref.php?mode=pref",$NATS->Lang->Item("user.options"), true),
 44: 	array("admin","admin.php",$NATS->Lang->Item("system.settings"),false) );
 45: 	
 46: 
 47: function PageMenu($name,$mode="")
 48: {
 49: global $pagemenu,$NATS_Session,$NATS;
 50: $restrict = $NATS->isUserRestricted($NATS_Session->username);
 51: if (($mode=="")&&isset($_REQUEST['mode'])) $mode=$_REQUEST['mode'];
 52: $out="";
 53: $first=true;
 54: foreach($pagemenu[$name] as $opt)
 55: 	{
 56: 		if (!$restrict || $opt[3]==true)
 57: 		{
 58: 			if ($first) $first=false;
 59: 			else $out.=" ";
 60: 			if ($mode!=$opt[0]) $out.="&nbsp;<a href=".$opt[1].">";
 61: 			else $out.="<b style=\"background-color: #ffffff;\">&nbsp;<a href=\"".$opt[1]."\" style=\"color: black; text-decoration: none;\">";
 62: 			$out.=$opt[2];
 63: 			if ($mode!=$opt[0]) $out.="</a>&nbsp; ";
 64: 			else $out.="</a>&nbsp;</b>";
 65: 		}
 66: 	}
 67: return $out;
 68: }
 69: 	
 70: $poplist=array();
 71: 
 72: function Screen_Header($title,$menuindex=0,$alertpane=0,$ah="",$pagemenu="",$pagemenumode="")
 73: {
 74: global $menu,$NATS,$NATS_Session;
 75: if ($NATS->Cfg->Get("site.enable.interactive")!=1)
 76: 	{
 77: 	echo "Sorry but FreeNATS interactive is disabled.<br>";
 78: 	echo "<i>site.enable.interactive</i> != 1<br><br>";
 79: 	echo "To resolve this issue your system administrator needs to set the FreeNATS system variable site.enable.interactive to 1.<br><br>";
 80: 	$NATS->Stop();
 81: 	exit();
 82: 	}
 83: if ($menuindex==1) $alertpane=1; // bodge
 84: 
 85: if ( ($menuindex==1) && ($pagemenu=="main") ) $secCheckFirstrun=true;
 86: else $secCheckFirstrun=false; // KLUDGE
 87: 
 88: //if ($NATS_Session->userlevel>9) $menuindex=2; // further bodge!
 89: echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">";
 90: echo "<html><head><title>FreeNATS: ".$title."</title>\n";
 91: echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n";
 92: echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"css/main.css\">\n";
 93: /*
 94: echo "<style type=\"text/css\">\n";
 95: require("css/main.css");
 96: echo "\n</style>\n";
 97: */
 98: if ($ah!="") echo $ah;
 99: echo "<script type=\"text/javascript\" src=\"js/freenats.js\"></script>\n";
100: echo "</head>\n";
101: 
102: echo "<body>";
103: 
104: echo "<table class=\"maintitle\" cellspacing=0 cellpadding=0>\n";
105: echo "<tr><td align=left valign=center class=\"mainleft\">\n";
106: echo "<b class=\"maintitle\">".$title."</b>";
107: if ($pagemenu!="") echo "<br>&nbsp;&nbsp;<b>".PageMenu($pagemenu,$pagemenumode)."</b>";
108: echo "</td>\n";
109: echo "<td class=\"titlelink\" align=right valign=center>\n";
110: echo $menu[$menuindex];
111: echo "&nbsp;</td></tr>\n";
112: //echo "<tr><td align=left valign=bottom><img src=images/e0e0ff.10px.bl.jpg></td>";
113: //echo "</tr>\n";
114: echo "</table>\n";
115: 
116: if ($secCheckFirstrun && ( $NATS->Cfg->Get("site.firstrun.ignore",0) != 1 ) )
117: 	{
118: 	if (file_exists("firstrun.php"))
119: 		{
120: 		echo "<div class=\"sec_warning\">";
121: 		echo "<b>".$NATS->Lang->Item("sec.firstrun")."</b><br />";
122: 		echo $NATS->Lang->Item("sec.firstrun.text")."<br />";
123: 		echo $NATS->Lang->Item("sec.firstrun.ignore")."<BR />";
124: 		echo "<a href=\"http://www.purplepixie.org/freenats/wiki/Firstrun_Warning\" target=\"top\">http://www.purplepixie.org/freenats/wiki/Firstrun_Warning</a>";
125: 		
126: 		echo "</div>";
127: 		}
128: 	}
129: 
130: if ($NATS->Cfg->Get("site.tester.suspended",0) == 1)
131: {
132: 	
133: 	echo "<div class=\"sec_warning\">";
134: 	echo "<b>".$NATS->Lang->Item("testing.suspended")."</b><br />";
135: 	echo $NATS->Lang->Item("testing.suspended.explain")."<br />";
136: 	echo "<a href=\"admin.php\">".$NATS->Lang->Item("system.settings")."</a>";
137: 	echo "</div>";
138: 		
139: }
140: 
141: 
142: if ($alertpane==1)
143: 	{
144: 	$alerts=$NATS->GetAlerts();
145: 	if (is_array($alerts))
146: 		{
147: 		echo "<div class=\"alertpane\" id=\"fn_alertpane\">";
148: 		echo "<b><u>".$NATS->Lang->Item("nats.alerts")."</u></b><br><br>";
149: 		foreach($alerts as $alert)
150: 			{
151: 			echo "&nbsp;<a href=node.php?nodeid=".$alert['nodeid'].">";
152: 			echo "<b class=\"al".$alert['alertlevel']."\">".$alert['nodeid']."</b></a><br>";
153: 			}
154: 		echo "<br>";
155: 		echo "</div>";
156: 		}
157: 	}
158: 
159: }
160: 
161: function Start_Round($title,$width="")
162: {
163: if ($width!="") $w=" width=".$width;
164: else $w="";
165: echo "<table border=0".$w." cellspacing=0 cellpadding=0>\n";
166: echo "<tr><td valign=top align=left width=11 style=\"background-color: #e0e0ff;\"><img src=images/e0e0ff.10px.tl.jpg></td>\n";
167: echo "<td align=left valign=center style=\"background-color: #e0e0ff;\">\n";
168: echo $title;
169: echo "\n</td><td align=right valign=top style=\"background-color: #e0e0ff;\"><img src=images/e0e0ff.10px.tr.jpg></td></tr>\n";
170: echo "<tr><td colspan=3 style=\"border-left: solid 1px #e0e0ff; border-bottom: solid 1px #e0e0ff; border-right: solid 1px #e0e0ff; padding: 5px;\">\n";
171: }
172: 
173: function End_Round()
174: {
175: echo "\n</td></tr>\n";
176: 
177: echo "</table>";
178: }
179: 
180: function Screen_Footer($track_if_enabled=true)
181: {
182: global $NATS,$poplist;
183: echo "<br><br>\n";
184: //$NATS->Cfg->DumpToScreen();
185: echo "<div class=\"nfooter\">";
186: echo "<div class=\"bl\"><div class=\"br\"><div class=\"tl\"><div class=\"tr\">";
187: 
188: echo "<div align=\"left\" class=\"nfootleft\"><a href=http://www.purplepixie.org/freenats/>FreeNATS</a>; &copy; ".$NATS->Lang->Item("copyright")." 2008-2017 ";
189: echo "<a href=http://www.purplepixie.org/>PurplePixie Systems</a>";
190: echo "</div><div class=\"nfootright\">";
191: echo $NATS->Lang->Item("version").": ".$NATS->Version;
192: if ($NATS->Release!="") echo "/".$NATS->Release;
193: echo "&nbsp;&nbsp;</div>";
194: 
195: //echo "Hello";
196: echo "</div></div></div></div>";
197: echo "</div>";
198: if (ini_get("freenats.rpath")==1)
199: 	{
200: 	echo "<i>FreeNATS Virtual Server Powered By <a href=http://www.rpath.org/>rPath</a> LAMP Appliance</i><br>";
201: 	}
202: //echo "<i>This is alpha-test software - we would very much value your ";
203: //echo "<a href=http://www.purplepixie.org/freenats/feedback.php>feedback</a></i><br>";
204: 
205: $autofeedback=false;
206: if ($track_if_enabled)
207: 	{
208: 	$t=$NATS->Cfg->Get("freenats.tracker");
209: 	if ( ($t!="") && ($t>0) )
210: 		{
211: 		$autofeedback=true;
212: 		$usid=$NATS->Cfg->Get("freenats.tracker.usid","");
213: 		if ($usid=="")
214: 			{ // generate usid if not already set
215: 			// usid form XYZ-XYZ-XYZ...
216: 			$allow="abcdef0123456789";
217: 			$allow_len=strlen($allow);
218: 			mt_srand(microtime()*1000000);
219: 			$first_set=1;
220: 			for ($a=0; $a<5; $a++) // blocks
221: 				{
222: 				if ($first_set==1) $first_set=0;
223: 				else $usid.="-";
224: 				for ($b=0; $b<10; $b++)
225: 					{
226: 					$c=mt_rand(0,$allow_len-1);
227: 					$usid.=$allow[$c];
228: 					}
229: 				}
230: 			$NATS->Cfg->Set("freenats.tracker.usid",$usid);
231: 			}
232: 			
233: 		// get some more data
234: 		$sn=explode("/",$_SERVER['SCRIPT_NAME']);
235: 		$script=$sn[count($sn)-1];
236: 		
237: 		// show tracking image
238: 		echo "<img src=\"http://www.purplepixie.org/freenats/report/ping.png.php?data=v=".$NATS->Version."+p=".$script."&type=ping&usid=".$usid."\" width=1 height=1>\n";
239: 		}
240: 	}
241: 
242: //$NATS->PageError("fish","swim in the sea");
243: //$NATS->PageError("dogs","walk on the land");
244: //$autofeedback=true;
245: 
246: if (count($NATS->PageErrors)>0) // page errors reported
247: 	{
248: 	echo "<div class=\"page_error\">\n";
249: 	echo "Errors detected on page: ";
250: 	$url="";
251: 	$counter=0;
252: 	foreach($NATS->PageErrors as $PageError)
253: 		{
254: 		if ($counter>0) $url.="&";
255: 		$url.="code[".$counter."]=".urlencode($PageError['code'])."&desc[".$counter."]=".urlencode($PageError['desc']);
256: 		$counter++;
257: 		}
258: 	$url.="&ver=".$NATS->Version;
259: 		
260: 	echo "<script type=\"text/javascript\">\n";
261: 	echo "function report_error()\n";
262: 	echo "{\n";
263: 	echo "document.getElementById('error_report_result').innerHTML = 'Reporting Now...';\n";
264: 	echo "var s = document.createElement(\"script\");\n";
265: 	echo "s.src = \"http://www.purplepixie.org/freenats/report/error.php?".$url."\";\n";
266: 	echo "document.body.appendChild(s);\n";
267: 	echo "}\n";
268: 	echo "</script>";
269: 		
270: 	echo "<span id=\"error_report_result\">";
271: 	if ($autofeedback)
272: 		{
273: 		echo "Reporting...";
274: 		}
275: 	else
276: 		{
277: 		echo "<a href=\"javascript:report_error();\">Click to report to PurplePixie</a> | ";
278: 		//echo "<a href=\"javascript:displayToggle('error_detail');\">Click to show/hide details</a>";
279: 		}
280: 	echo "</span>&nbsp; ";
281: 	echo "<a href=\"javascript:displayToggle('error_detail');\">Click to show/hide details</a>";
282: 	echo "<div id=\"error_detail\" style=\"display: none;\">\n";
283: 	foreach($NATS->PageErrors as $PageError)
284: 		{
285: 		echo "# ".$PageError['code']." : ".$PageError['desc']."<BR />\n";
286: 		}
287: 	echo "</div>";
288: 	echo "</div>\n";
289: 	
290: 	if ($autofeedback)
291: 		{
292: 		//echo "<script src=\"http://www.purplepixie.org/freenats/report/error.php?".$url."\" type=\"text/javascript\"></script>\n";
293: 		echo "<script type=\"text/javascript\">\n";
294: 		echo "report_error();\n";
295: 		echo "</script>\n";
296: 		}
297: 		
298: 	}
299: 		
300: if ($NATS->Cfg->Get("site.popupmessage")=="1")
301: 	{
302: 	if (count($poplist)>0)
303: 		{
304: 		echo "\n<script type=\"text/javascript\">\n";
305: 		
306: 		foreach($poplist as $pop)
307: 			{
308: 			echo "alert('".$pop."');\n";
309: 			}
310: 			
311: 		echo "</script>\n";
312: 		}
313: 	}
314: echo "\n</body></html>\n";
315: }
316: 
317: function UL_Error($task="")
318: {
319: global $NATS;
320: Screen_Header($NATS->Lang->Item("access.error"));
321: echo "<br>".$NATS->Lang->Item("access.error.detail")." (".$task.").<br><br>";
322: echo "<a href=main.php>".$NATS->Lang->Item("click.continue")."</a><br><br>";
323: Screen_Footer();
324: exit();
325: }
326: 
327: function Session_Error()
328: {
329: global $REQUEST_URI;
330: header("Location: ./?login_msg=Invalid+or+Expired+Session&url=".urlencode($REQUEST_URI));
331: exit();
332: }
333: 
334: function nicedt($ts)
335: {
336: global $NATS;
337: $form="H:i:s d/m/Y";
338: if (isset($NATS)) $form=$NATS->Cfg->Get("site.dtformat","H:i:s d/m/Y");
339: if ($ts<=0) return $NATS->Lang->Item("never");
340: return date($form,$ts);
341: }
342: 
343: function enicedt($ts)
344: {
345: echo nicedt($ts);
346: }
347: 
348: function nicediff($diff)
349: {
350: $hr=0;
351: $mn=0;
352: $se=0;
353: if ($diff>59)
354: 	{
355: 	$mn=round($diff/60,0);
356: 	$se=$diff%60;
357: 	if ($mn>59)
358: 		{
359: 		$hr=round($mn/60,0);
360: 		$mn=$mn%60;
361: 		}
362: 	}
363: else $se=$diff;
364: $s="";
365: if ($hr<10) $s="0";
366: $s.=$hr.":";
367: if ($mn<10) $s.="0";
368: $s.=$mn.":";
369: if ($se<10) $s.="0";
370: $s.=$se;
371: return $s;
372: }
373: 
374: function dtago($ts,$sayago=true)
375: {
376: global $NATS;
377: if ($ts<=0) return $NATS->Lang->Item("never");
378: $now=time();
379: $diff=$now-$ts;
380: $s=nicediff($diff);
381: if ($sayago) $s.=" ".$NATS->Lang->Item("ago");
382: return $s;
383: }
384: 
385: function nicenextx($nextx)
386: {
387: if ($nextx<=0) return "Now";
388: $diff=$nextx-time();
389: if ($diff<0)
390: 	{
391: 	$sign=" ago";
392: 	$diff=0-$diff;
393: 	}
394: else $sign="";
395: return nicediff($diff).$sign;
396: }
397: 
398: function edtago($ts)
399: {
400: echo dtago($ts);
401: }
402: 
403: function smartx($x) // smart handling of unixtime x variables
404: {
405: if ($x==0) return time();	// 0 = now
406: else if ($x<0)				// -z = now - z seconds
407: 	return (time()+$x);		// negative number so +
408: else						// positive number so is a unixtime
409: 	return $x;
410: }
411: 
412: $allowed="00123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz@_-.,:&/~%=+(){}[]#?$";
413: 
414: function nices($s)
415: {
416: global $allowed;
417: $o="";
418: for ($a=0; $a<strlen($s); $a++)
419: 	{
420: 	$c=$s[$a];
421: 	if (strpos($allowed,$c)===false)
422: 		{
423: 		// skip it
424: 		}
425: 	else $o.=$c;
426: 	}
427: return $o;
428: }
429: /* // Old Static List Function
430: function ShowIcons()
431: {
432: global $fnIcons,$fnIcon_DefNode,$fnIcon_DefGroup;
433: $c=0;
434: echo "<table border=0>";
435: $cc=0;
436: for ($a=0; $a<count($fnIcons); $a++)
437: 	{
438: 	if ($cc==0) echo "<tr>";
439: 	echo "<td valign=top align=center><img src=icons/".$fnIcons[$a]."><br>".$fnIcons[$a]."<br>";
440: 	if ($a==$fnIcon_DefNode) echo "<i>Node Default</i> ";
441: 	if ($a==$fnIcon_DefGroup) echo "<i>Group Default</i>";
442: 	echo "</td>";
443: 	$cc++;
444: 	if ($cc>=5)
445: 		{
446: 		echo "</tr>";
447: 		$cc=0;
448: 		}
449: 	}
450: if ($cc>0) echo "</tr>";
451: echo "</table>";
452: }
453: */
454: 
455: function GetIcons()
456: {
457: $iconFiles=glob("icons/{*.gif,*.GIF,*.jpg,*.JPG,*.jpeg,*.JPEG,*.png,*.PNG}", GLOB_BRACE);
458: for($a=0;$a<count($iconFiles);$a++)
459: 	$iconFiles[$a]=substr($iconFiles[$a],6);
460: return $iconFiles;
461: }
462: 
463: 
464: function ShowIcons()
465: {
466: global $fnIcons,$fnIcon_DefNode,$fnIcon_DefGroup,$NATS;
467: $c=0;
468: echo "<table border=0>";
469: $cc=0;
470: $iconFiles=GetIcons();
471: for ($a=0; $a<count($iconFiles); $a++)
472: 	{
473: 	$icon=$iconFiles[$a];
474: 	if ($cc==0) echo "<tr>";
475: 	echo "<td valign=top align=center><img src=icons/".$icon."><br>".$icon."<br>";
476: 	if ($icon==$fnIcons[$fnIcon_DefNode]) echo "<i>".$NATS->Lang->Item("node.default")."</i> ";
477: 	if ($a==$fnIcons[$fnIcon_DefGroup]) echo "<i>".$NATS->Lang->Item("group.default")."</i>";
478: 	echo "</td>";
479: 	$cc++;
480: 	if ($cc>=5)
481: 		{
482: 		echo "</tr>";
483: 		$cc=0;
484: 		}
485: 	}
486: if ($cc>0) echo "</tr>";
487: echo "</table>";
488: }
489: 
490: 
491: 
492: function NodeIcon($nodeid)
493: {
494: global $NATS,$fnIcons,$fnIcon_DefNode;
495: $q="SELECT nodeicon FROM fnnode WHERE nodeid=\"".ss($nodeid)."\"";
496: $r=$NATS->DB->Query($q);
497: if ($row=$NATS->DB->Fetch_Array($r)) 
498: 	{
499: 	if ($row['nodeicon']!="") return $row['nodeicon'];
500: 	}
501: return $fnIcons[$fnIcon_DefNode];
502: }
503: 
504: function GroupIcon($groupid)
505: {
506: global $NATS,$fnIcons,$fnIcon_DefGroup;
507: $q="SELECT groupicon FROM fngroup WHERE groupid=\"".ss($groupid)."\"";
508: $r=$NATS->DB->Query($q);
509: if ($row=$NATS->DB->Fetch_Array($r)) 
510: 	{
511: 	if ($row['groupicon']!="") return $row['groupicon'];
512: 	}
513: return $fnIcons[$fnIcon_DefGroup];
514: }
515: 
516: function np_tiny($nodeid,$text=true,$nodename="",$jslink=false)
517: {
518: global $NATS;
519: $al=$NATS->NodeAlertLevel($nodeid);
520: echo "<table class=\"nptiny-al".$al."\">";
521: echo "<tr><td valign=center align=center>";
522: if ($jslink) echo "<a href=\"javascript:nodeClick('".$nodeid."');\">";
523: else echo "<a href=node.php?nodeid=".$nodeid.">";
524: echo "<img src=\"icons/".NodeIcon($nodeid)."\" border=0>";
525: echo "</a>";
526: if ($text)
527: 	{
528: 	if ($nodename=="") $nodename=$nodeid;
529: 	
530: 	//$words=explode(" ",$nodename);
531: 	
532: 	// messy but there you go...
533: 	
534: 	$max_on_line=7;
535: 	$max_lines=2;
536: 	$len=strlen($nodename);
537: 	$out="";
538: 	$linecount=0;
539: 	$charcount=0;
540: 	for ($a=0; $a<$len; $a++)
541: 		{
542: 			
543: 		$char=$nodename[$a];
544: 		
545: 		if ($char==" ")
546: 			{
547: 			$linecount++;
548: 			$charcount=0;
549: 			}
550: 		else $charcount++;
551: 		
552: 		if ($charcount>=$max_on_line) 
553: 			{
554: 			$a=$len+10;
555: 			$out.="..";
556: 			}
557: 		else if ($linecount>=$max_lines) 
558: 			{
559: 			$a=$len+10;
560: 			$out.="..";
561: 			}
562: 		else $out.=$char;
563: 		
564: 		}
565: 	//if ($a==($len+10)) $out.="..";
566: 	$nodename=$out;
567: 	
568: 	$size=10;
569: 		
570: /* -- size-based	
571: 	$len=strlen($nodename);
572: 	if ($len<9) $size=10;
573: 	else if ($len<15) $size=8;
574: 	else if ($len<20) $size=7;
575: 	else
576: 		{
577: 		$size=6;
578: 		$nodename=substr($nodename,0,18)."..";
579: 		}
580: */
581: 	
582: 	echo "<br><b class=\"al".$al."\" style=\"font-size: ".$size."pt;\">".$nodename."</b>";
583: 	}
584: echo "</td></tr></table>";
585: }
586: 
587: function ng_tiny($groupid,$groupname="",$text=true)
588: {
589: global $NATS;
590: // to do - get groupname if not sent but F--- it for now
591: $al=$NATS->GroupAlertLevel($groupid);
592: echo "<table class=\"nptiny-al".$al."\">";
593: echo "<tr><td valign=center align=center>";
594: echo "<a href=group.php?groupid=".$groupid.">";
595: echo "<img src=\"icons/".GroupIcon($groupid)."\" border=0>";
596: echo "</a>";
597: if ($text)
598: 	{
599: 	echo "<br><b class=\"al".$al."\">".$groupname."</b>";
600: 	}
601: echo "</td></tr></table>";
602: }
603: 
604: function ng_big($groupid,$groupname="",$groupdesc="",$groupicon="")
605: {
606: global $NATS;
607: if ($groupicon=="") $groupicon=GroupIcon($groupid);
608: $al=$NATS->GroupAlertLevel($groupid);
609: echo "<table class=\"npbig-al".$al."\">";
610: echo "<tr><td align=left valign=top>";
611: echo "<table class=\"nicetable\" width=300>";
612: echo "<tr><td align=right>".$NATS->Lang->Item("group.name")." :";
613: echo "</td><td align=left><a href=group.php?groupid=".$groupid.">".$groupname."</a></td></tr>";
614: echo "<tr><td align=right>".$NATS->Lang->Item("description")." :";
615: echo "</td><td align=left>".$groupdesc."</td></tr>";
616: echo "<tr><td align=right>".$NATS->Lang->Item("status")."</td><td align=left>";
617: echo "<b class=\"al".$al."\">".oText($al)."</b></td></tr>";
618: echo "</table></td>";
619: //echo "<td align=left valign=top align=right width=60>";
620: //echo "<img src=icons/".GroupIcon($groupid).">";
621: //echo "</td>";
622: echo "</tr>";
623: echo "</table>";
624: }
625: 
626: function np_big($nodeid,$nodename="",$nodedesc="",$nodeicon="",$jslink=false)
627: {
628: global $NATS;
629: if ($nodedesc=="") $nodedesc="&nbsp;";
630: if ($nodeicon=="") $nodeicon=NodeIcon($nodeid);
631: $al=$NATS->NodeAlertLevel($nodeid);
632: echo "<table class=\"npbig-al".$al."\">";
633: echo "<tr><td align=left valign=top>";
634: echo "<table class=\"nicetable\" width=300>";
635: echo "<tr><td align=right>".$NATS->Lang->Item("node.name")." :";
636: if ($nodename=="") $nodename=$nodeid;
637: echo "</td><td align=left>";
638: if ($jslink) echo "<a href=\"javascript:nodeClick('".$nodeid."');\">";
639: else echo "<a href=node.php?nodeid=".$nodeid.">";
640: echo $nodename."</a></td></tr>";
641: echo "<tr><td align=right>".$NATS->Lang->Item("description")." :";
642: echo "</td><td align=left>".$nodedesc."</td></tr>";
643: echo "<tr><td align=right>".$NATS->Lang->item("status")." :</td><td align=left>";
644: echo "<b class=\"al".$al."\">".oText($al)."</b></td></tr>";
645: echo "</table></td>";
646: //echo "<td align=left valign=top align=right width=60>";
647: //echo "<img src=icons/".GroupIcon($groupid).">";
648: //echo "</td>";
649: echo "</tr>";
650: echo "</table>";
651: }
652: 
653: function GetAbsolute($filename="")
654: { // sooooooooo messy but looks like the ONLY FRICKIN' WAY!
655: if ((isset($_SERVER['HTTPS']))&&($_SERVER['HTTPS']!="")) $uri="https://";
656: else $uri="http://";
657: $uri.=$_SERVER['HTTP_HOST'];
658: $uri.=$_SERVER['REQUEST_URI'];
659: $pos=strripos($uri,"/");
660: $rdir=substr($uri,0,$pos+1);
661: return $rdir.$filename;
662: }
663: 
664: 
665: ?>
666: