'; print '
WARNING - '; print 'Sorry, it\'s partly laziness on my part, but you really need JavaScript enabled and DOM support in your browser to use this editor. It\'s a visual tool, so accessibility is already an issue, if it is, and from a security viewpoint, you\'re already running my '; print 'code on your server so either you trust it all having read it, or you\'re already screwed.

'; print 'If it\'s a major issue for you, please feel free to complain. It\'s mainly laziness as I said, and there could be a fallback (not so smooth) mode for non-javascript browsers if it was seen to be worthwhile (I would take a bit of convincing, because I don\'t see a benefit, personally).

'; $errormessage = ""; if(! $cacti_found && !$ignore_cacti) { $errormessage .= '$cacti_base is not set correctly. Cacti integration will be disabled in the editor.'; if($config_loaded != 1) { $errormessage .= " You might need to copy editor-config.php-dist to editor-config.php and edit it."; } } if($errormessage != '') { print '
'.$errormessage.'
'; } print '
'; print '
Welcome
'; print 'Welcome to the PHP Weathermap '.$WEATHERMAP_VERSION.' editor.

'; print '

NOTE: This editor is not finished! There are many features of '; print 'Weathermap that you will be missing out on if you choose to use the editor only.'; print 'These include: curves, node offsets, font definitions, colour changing, per-node/per-link settings and image uploading. You CAN use the editor without damaging these features if you added them by hand, however.

'; print 'Do you want to:

'; print 'Create A New Map:
'; print '

'; print 'Named: '; print ''; print ''; print '
'; print 'OR
'; print 'Open An Existing Map (looking in ' . $mapdir . '):
    '; $titles = array(); if (is_dir($mapdir)) { $n=0; $dh=opendir($mapdir); if ($dh) { while ($file=readdir($dh)) { $realfile=$mapdir . DIRECTORY_SEPARATOR . $file; // if(is_file($realfile) && ( preg_match('/\.conf$/',$file) )) if ( (is_file($realfile)) && (is_readable($realfile)) ) { $title='(no title)'; $fd=fopen($realfile, "r"); if($fd) { while (!feof($fd)) { $buffer=fgets($fd, 4096); if (preg_match("/^\s*TITLE\s+(.*)/i", $buffer, $matches)) { $title=$matches[1]; } } fclose ($fd); $titles[$file] = $title; # print "
  • $file - $title
  • \n"; $n++; } } } closedir ($dh); } else { print "
  • Can't Open mapdir to read
  • "; } ksort($titles); foreach ($titles as $file=>$title) { $title = $titles[$file]; print "
  • $file - $title
  • \n"; } if ($n == 0) { print "
  • No files
  • "; } } else { print "
  • NO DIRECTORY named $mapdir
  • "; } print "
"; print "
"; // dlgbody print '
PHP Weathermap ' . $WEATHERMAP_VERSION . ' Copyright © 2005-2007 Howard Jones - howie@thingy.com
The current version should always be available here, along with other related software. PHP Weathermap is licensed under the GNU Public License, version 2. See COPYING for details. This distribution also includes the Overlib library by Erik Bosrup.
'; print "
"; // dlgStart print "
"; // withjs print ""; } function snap($coord, $gridsnap = 0) { if ($gridsnap == 0) { return ($coord); } else { return ($coord - ($coord % $gridsnap)); } } // Following function is based on code taken from here: // http://uk2.php.net/manual/en/security.globals.php // // It extracts a set of named variables into the global namespace, // validating them as they go. Returns True or False depending on if // validation fails. If it does fail, then nothing is added to the // global namespace. // function extract_with_validation($array, $paramarray, $prefix = "", $debug = FALSE) { $all_present=TRUE; $candidates=array( ); if ($debug) print '
';

	if ($debug)
		print_r ($paramarray);

	if ($debug)
		print_r ($array);

	foreach ($paramarray as $var)
	{
		$varname=$var[0];
		$vartype=$var[1];
		$varreqd=$var[2];

		if ($varreqd == 'req' && !array_key_exists($varname, $array)) { $all_present=FALSE; }

		if (array_key_exists($varname, $array))
		{
			$varvalue=$array[$varname];

			if ($debug)
				print "Checking $varname...";

			$waspresent=$all_present;

			switch ($vartype)
			{
			case 'int':
				if (!preg_match('/^\-*\d+$/', $varvalue)) { $all_present=FALSE; }

				break;

			case 'float':
				if (!preg_match('/^\d+\.\d+$/', $varvalue)) { $all_present=FALSE; }

				break;

			case 'yesno':
				if (!preg_match('/^(y|n|yes|no)$/i', $varvalue)) { $all_present=FALSE; }

				break;

			case 'sqldate':
				if (!preg_match('/^\d\d\d\d\-\d\d\-\d\d$/i', $varvalue)) { $all_present=FALSE; }

				break;

			case 'any':
				// we don't care at all
				break;

			case 'ip':
				if (!preg_match(
					'/^((\d|[1-9]\d|2[0-4]\d|25[0-5]|1\d\d)(?:\.(\d|[1-9]\d|2[0-4]\d|25[0-5]|1\d\d)){3})$/',
					$varvalue)) { $all_present=FALSE; }

				break;

			case 'alpha':
				if (!preg_match('/^[A-Za-z]+$/', $varvalue)) { $all_present=FALSE; }

				break;

			case 'alphanum':
				if (!preg_match('/^[A-Za-z0-9]+$/', $varvalue)) { $all_present=FALSE; }

				break;

			case 'bandwidth':
				if (!preg_match('/^\d+\.?\d*[KMGT]*$/i', $varvalue)) { $all_present=FALSE; }

				break;

			default:
				// an unknown type counts as an error, really
				$all_present=FALSE;

				break;
			}

			if ($debug && $waspresent != $all_present) { print "Failed on $varname."; }

			if ($all_present)
			{
				$candidates["{$prefix}{$varname}"]=$varvalue;
				$candidates["{$prefix}{$varname}_slashes"]=addslashes($varvalue);
				$candidates["{$prefix}{$varname}_url"]=urlencode($varvalue);
				$candidates["{$prefix}{$varname}_html"]=htmlspecialchars($varvalue);
				$candidates["{$prefix}{$varname}_url_html"]=htmlspecialchars(urlencode($varvalue));
			}
		}
		else
		{
			if ($debug)
				print "Skipping $varname\n";
		}
	}

	if ($debug)
		print_r ($candidates);

	if ($all_present)
	{
		foreach ($candidates as $key => $value) { $GLOBALS[$key]=$value; }
	}

	if ($debug)
		print '
'; return ($all_present); } function get_imagelist($imagedir) { $imagelist = array(); if (is_dir($imagedir)) { $n=0; $dh=opendir($imagedir); if ($dh) { while ($file=readdir($dh)) { $realfile=$imagedir . DIRECTORY_SEPARATOR . $file; $uri = $imagedir . "/" . $file; if(is_file($realfile) && ( preg_match('/\.(gif|jpg|png)$/i',$file) )) { $imagelist[] = $uri; $n++; } } closedir ($dh); } } return ($imagelist); } function handle_inheritance(&$map, &$inheritables) { foreach ($inheritables as $inheritable) { $fieldname = $inheritable[1]; $formname = $inheritable[2]; $new = $_REQUEST[$formname]; $old = ($inheritable[0]=='node' ? $map->defaultnode->$fieldname : $map->defaultlink->$fieldname); if($old != $new) { if($inheritable[0]=='node') { $map->defaultnode->$fieldname = $new; foreach ($map->nodes as $node) { if($node->$fieldname == $old) { $map->nodes[$node->name]->$fieldname = $new; } } } if($inheritable[0]=='link') { $map->defaultlink->$fieldname = $new; foreach ($map->links as $link) { if($link->$fieldname == $old) { $map->links[$link->name]->$fieldname = $new; } } } } } } function get_fontlist(&$map,$name,$current) { $output = '"; return($output); } // vim:ts=4:sw=4: ?> WebSVN - weathermap - Blame - Rev 58 - /editor.inc.php
  jablonka.czprosek.czf

weathermap

Subversion Repositories:
[/] [editor.inc.php] - Blame information for rev 58

 

Line No. Rev Author Line

Powered by WebSVN 2.2.1