File: 1.19.1b/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=\"//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 = \"//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: $dd=0;
354: 
355: if ($diff>59)
356: 	{
357: 	$mn=round($diff/60,0);
358: 	$se=$diff%60;
359: 	if ($mn>59)
360: 		{
361: 		$hr=round($mn/60,0);
362: 		$mn=$mn%60;
363:         if ($hr>23)
364:             $dd=round($hr/24,0);
365:             $hr=$hr%24;
366: 		}
367: 	}
368: else $se=$diff;
369: $s="";
370: if ($dd) {
371:     global $NATS;
372:     $s = $dd.' '.($dd == 1 ? $NATS->Lang->Item("day") : $NATS->Lang->Item("days")).' ';
373: }
374: if ($hr<10) $s.="0";
375: $s.=$hr.":";
376: if ($mn<10) $s.="0";
377: $s.=$mn.":";
378: if ($se<10) $s.="0";
379: $s.=$se;
380: return $s;
381: }
382: 
383: function dtago($ts,$sayago=true)
384: {
385: global $NATS;
386: if ($ts<=0) return $NATS->Lang->Item("never");
387: $now=time();
388: $diff=$now-$ts;
389: $s=nicediff($diff);
390: if ($sayago) $s.=" ".$NATS->Lang->Item("ago");
391: return $s;
392: }
393: 
394: function nicenextx($nextx)
395: {
396: if ($nextx<=0) return "Now";
397: $diff=$nextx-time();
398: if ($diff<0)
399: 	{
400: 	$sign=" ago";
401: 	$diff=0-$diff;
402: 	}
403: else $sign="";
404: return nicediff($diff).$sign;
405: }
406: 
407: function edtago($ts)
408: {
409: echo dtago($ts);
410: }
411: 
412: function smartx($x) // smart handling of unixtime x variables
413: {
414: if ($x==0) return time();	// 0 = now
415: else if ($x<0)				// -z = now - z seconds
416: 	return (time()+$x);		// negative number so +
417: else						// positive number so is a unixtime
418: 	return $x;
419: }
420: 
421: $allowed="00123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz@_-.,:&/~%=+(){}[]#?$";
422: 
423: function nices($s)
424: {
425: global $allowed;
426: $o="";
427: for ($a=0; $a<strlen($s); $a++)
428: 	{
429: 	$c=$s[$a];
430: 	if (strpos($allowed,$c)===false)
431: 		{
432: 		// skip it
433: 		}
434: 	else $o.=$c;
435: 	}
436: return $o;
437: }
438: /* // Old Static List Function
439: function ShowIcons()
440: {
441: global $fnIcons,$fnIcon_DefNode,$fnIcon_DefGroup;
442: $c=0;
443: echo "<table border=0>";
444: $cc=0;
445: for ($a=0; $a<count($fnIcons); $a++)
446: 	{
447: 	if ($cc==0) echo "<tr>";
448: 	echo "<td valign=top align=center><img src=icons/".$fnIcons[$a]."><br>".$fnIcons[$a]."<br>";
449: 	if ($a==$fnIcon_DefNode) echo "<i>Node Default</i> ";
450: 	if ($a==$fnIcon_DefGroup) echo "<i>Group Default</i>";
451: 	echo "</td>";
452: 	$cc++;
453: 	if ($cc>=5)
454: 		{
455: 		echo "</tr>";
456: 		$cc=0;
457: 		}
458: 	}
459: if ($cc>0) echo "</tr>";
460: echo "</table>";
461: }
462: */
463: 
464: function GetIcons()
465: {
466: $iconFiles=glob("icons/{*.gif,*.GIF,*.jpg,*.JPG,*.jpeg,*.JPEG,*.png,*.PNG}", GLOB_BRACE);
467: for($a=0;$a<count($iconFiles);$a++)
468: 	$iconFiles[$a]=substr($iconFiles[$a],6);
469: return $iconFiles;
470: }
471: 
472: 
473: function ShowIcons()
474: {
475: global $fnIcons,$fnIcon_DefNode,$fnIcon_DefGroup,$NATS;
476: $c=0;
477: echo "<table border=0>";
478: $cc=0;
479: $iconFiles=GetIcons();
480: for ($a=0; $a<count($iconFiles); $a++)
481: 	{
482: 	$icon=$iconFiles[$a];
483: 	if ($cc==0) echo "<tr>";
484: 	echo "<td valign=top align=center><img src=icons/".$icon."><br>".$icon."<br>";
485: 	if ($icon==$fnIcons[$fnIcon_DefNode]) echo "<i>".$NATS->Lang->Item("node.default")."</i> ";
486: 	if ($a==$fnIcons[$fnIcon_DefGroup]) echo "<i>".$NATS->Lang->Item("group.default")."</i>";
487: 	echo "</td>";
488: 	$cc++;
489: 	if ($cc>=5)
490: 		{
491: 		echo "</tr>";
492: 		$cc=0;
493: 		}
494: 	}
495: if ($cc>0) echo "</tr>";
496: echo "</table>";
497: }
498: 
499: 
500: 
501: function NodeIcon($nodeid)
502: {
503: global $NATS,$fnIcons,$fnIcon_DefNode;
504: $q="SELECT nodeicon FROM fnnode WHERE nodeid=\"".ss($nodeid)."\"";
505: $r=$NATS->DB->Query($q);
506: if ($row=$NATS->DB->Fetch_Array($r))
507: 	{
508: 	if ($row['nodeicon']!="") return $row['nodeicon'];
509: 	}
510: return $fnIcons[$fnIcon_DefNode];
511: }
512: 
513: function GroupIcon($groupid)
514: {
515: global $NATS,$fnIcons,$fnIcon_DefGroup;
516: $q="SELECT groupicon FROM fngroup WHERE groupid=\"".ss($groupid)."\"";
517: $r=$NATS->DB->Query($q);
518: if ($row=$NATS->DB->Fetch_Array($r))
519: 	{
520: 	if ($row['groupicon']!="") return $row['groupicon'];
521: 	}
522: return $fnIcons[$fnIcon_DefGroup];
523: }
524: 
525: function np_tiny($nodeid,$text=true,$nodename="",$jslink=false)
526: {
527: global $NATS;
528: $al=$NATS->NodeAlertLevel($nodeid);
529: echo "<table class=\"nptiny-al".$al."\">";
530: echo "<tr><td valign=center align=center>";
531: if ($jslink) echo "<a href=\"javascript:nodeClick('".$nodeid."');\">";
532: else echo "<a href=node.php?nodeid=".$nodeid.">";
533: echo "<img src=\"icons/".NodeIcon($nodeid)."\" border=0>";
534: echo "</a>";
535: if ($text)
536: 	{
537: 	if ($nodename=="") $nodename=$nodeid;
538: 
539: 	//$words=explode(" ",$nodename);
540: 
541: 	// messy but there you go...
542: 
543: 	$max_on_line=7;
544: 	$max_lines=2;
545: 	$len=strlen($nodename);
546: 	$out="";
547: 	$linecount=0;
548: 	$charcount=0;
549: 	for ($a=0; $a<$len; $a++)
550: 		{
551: 
552: 		$char=$nodename[$a];
553: 
554: 		if ($char==" ")
555: 			{
556: 			$linecount++;
557: 			$charcount=0;
558: 			}
559: 		else $charcount++;
560: 
561: 		if ($charcount>=$max_on_line)
562: 			{
563: 			$a=$len+10;
564: 			$out.="..";
565: 			}
566: 		else if ($linecount>=$max_lines)
567: 			{
568: 			$a=$len+10;
569: 			$out.="..";
570: 			}
571: 		else $out.=$char;
572: 
573: 		}
574: 	//if ($a==($len+10)) $out.="..";
575: 	$nodename=$out;
576: 
577: 	$size=10;
578: 
579: /* -- size-based
580: 	$len=strlen($nodename);
581: 	if ($len<9) $size=10;
582: 	else if ($len<15) $size=8;
583: 	else if ($len<20) $size=7;
584: 	else
585: 		{
586: 		$size=6;
587: 		$nodename=substr($nodename,0,18)."..";
588: 		}
589: */
590: 
591: 	echo "<br><b class=\"al".$al."\" style=\"font-size: ".$size."pt;\">".$nodename."</b>";
592: 	}
593: echo "</td></tr></table>";
594: }
595: 
596: function ng_tiny($groupid,$groupname="",$text=true)
597: {
598: global $NATS;
599: // to do - get groupname if not sent but F--- it for now
600: $al=$NATS->GroupAlertLevel($groupid);
601: echo "<table class=\"nptiny-al".$al."\">";
602: echo "<tr><td valign=center align=center>";
603: echo "<a href=group.php?groupid=".$groupid.">";
604: echo "<img src=\"icons/".GroupIcon($groupid)."\" border=0>";
605: echo "</a>";
606: if ($text)
607: 	{
608: 	echo "<br><b class=\"al".$al."\">".$groupname."</b>";
609: 	}
610: echo "</td></tr></table>";
611: }
612: 
613: function ng_big($groupid,$groupname="",$groupdesc="",$groupicon="")
614: {
615: global $NATS;
616: if ($groupicon=="") $groupicon=GroupIcon($groupid);
617: $al=$NATS->GroupAlertLevel($groupid);
618: echo "<table class=\"npbig-al".$al."\">";
619: echo "<tr><td align=left valign=top>";
620: echo "<table class=\"nicetable\" width=300>";
621: echo "<tr><td align=right>".$NATS->Lang->Item("group.name")." :";
622: echo "</td><td align=left><a href=group.php?groupid=".$groupid.">".$groupname."</a></td></tr>";
623: echo "<tr><td align=right>".$NATS->Lang->Item("description")." :";
624: echo "</td><td align=left>".$groupdesc."</td></tr>";
625: echo "<tr><td align=right>".$NATS->Lang->Item("status")."</td><td align=left>";
626: echo "<b class=\"al".$al."\">".oText($al)."</b></td></tr>";
627: echo "</table></td>";
628: //echo "<td align=left valign=top align=right width=60>";
629: //echo "<img src=icons/".GroupIcon($groupid).">";
630: //echo "</td>";
631: echo "</tr>";
632: echo "</table>";
633: }
634: 
635: function np_big($nodeid,$nodename="",$nodedesc="",$nodeicon="",$jslink=false)
636: {
637: global $NATS;
638: if ($nodedesc=="") $nodedesc="&nbsp;";
639: if ($nodeicon=="") $nodeicon=NodeIcon($nodeid);
640: $al=$NATS->NodeAlertLevel($nodeid);
641: echo "<table class=\"npbig-al".$al."\">";
642: echo "<tr><td align=left valign=top>";
643: echo "<table class=\"nicetable\" width=300>";
644: echo "<tr><td align=right>".$NATS->Lang->Item("node.name")." :";
645: if ($nodename=="") $nodename=$nodeid;
646: echo "</td><td align=left>";
647: if ($jslink) echo "<a href=\"javascript:nodeClick('".$nodeid."');\">";
648: else echo "<a href=node.php?nodeid=".$nodeid.">";
649: echo $nodename."</a></td></tr>";
650: echo "<tr><td align=right>".$NATS->Lang->Item("description")." :";
651: echo "</td><td align=left>".$nodedesc."</td></tr>";
652: //echo "<tr><td align=right>".$NATS->Lang->item("status")." :</td><td align=left>";
653: echo "<tr><td align=right>".$NATS->Lang->Item("status")." :</td><td align=left>";
654: echo "<b class=\"al".$al."\">".oText($al)."</b></td></tr>";
655: echo "</table></td>";
656: //echo "<td align=left valign=top align=right width=60>";
657: //echo "<img src=icons/".GroupIcon($groupid).">";
658: //echo "</td>";
659: echo "</tr>";
660: echo "</table>";
661: }
662: function np_list_item($nodeid,$nodename="",$nodedesc="",$nodeenabled="",$jslink=false)
663: {
664: global $NATS;
665: if ($nodedesc=="") $nodedesc="&nbsp;";
666: $al=$NATS->NodeAlertLevel($nodeid);
667: if ($nodename=="") $nodename=$nodeid;
668: echo "<tr><td align=left>";
669: if ($jslink) echo "<a href=\"javascript:nodeClick('".$nodeid."');\">";
670: else echo "<a href=node.php?nodeid=".$nodeid.">";
671: echo $nodename."</a></td>";
672: echo "<td align=left>".$nodedesc."</td>";
673: echo "<td align=center>";
674: echo "<b class=\"al".$al."\">".oText($al)."</b></td>";
675: echo "<td align=center>".$NATS->Lang->Item($nodeenabled ? 'yes' : 'no')."</td>";
676: echo '</tr>';
677: }
678: 
679: function GetAbsolute($filename="")
680: { // sooooooooo messy but looks like the ONLY FRICKIN' WAY!
681: if ((isset($_SERVER['HTTPS']))&&($_SERVER['HTTPS']!="")) $uri="https://";
682: else $uri="http://";
683: $uri.=$_SERVER['HTTP_HOST'];
684: $uri.=$_SERVER['REQUEST_URI'];
685: $pos=strripos($uri,"/");
686: $rdir=substr($uri,0,$pos+1);
687: return $rdir.$filename;
688: }
689: 
690: 
691: ?>
692: