htdocs/extern.php
author Dan
Sun, 04 Jan 2009 16:42:52 -0500
changeset 45 53a50ba4d690
parent 36 a7d884914a74
permissions -rw-r--r--
Added last 60 minutes graph to index.php
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
36
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
     1
<?php
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
     2
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
     3
require('../stats-fe.php');
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
     4
require('../timezone.php');
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
     5
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
     6
$channel_list = stats_channel_list();
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
     7
$first_channel = $channel_list[0];
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
     8
$channel = ( isset($_REQUEST['channel']) && in_array($_REQUEST['channel'], $channel_list) ) ? $_REQUEST['channel'] : $first_channel;
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
     9
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    10
$formats = array('json', 'xml');
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    11
$format = ( isset($_GET['format']) ) ? $_GET['format'] : $formats[0];
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    12
if ( !in_array($format, $formats) )
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    13
{
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    14
  $format = $formats[0];
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    15
  $formatclass = "format_$format";
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    16
  $formatter = new $formatclass();
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    17
  $formatter->send_headers();
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    18
  die_in_output_format('Invalid output format specified.');
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    19
}
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    20
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    21
$formatclass = "format_$format";
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    22
$formatter = new $formatclass();
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    23
$formatter->send_headers();
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    24
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    25
if ( !isset($_GET['action']) )
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    26
  die_in_output_format('Please specify action on GET.');
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    27
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    28
switch($_GET['action'])
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    29
{
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    30
  case 'get_activity':
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    31
    $minutes = isset($_GET['minutes']) ? intval($_GET['minutes']) : 10;
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    32
    if ( $minutes < 1 )
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    33
      die_in_output_format('minutes < 1');
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    34
    $datum = stats_activity_percent($channel, $minutes);
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    35
    $count = stats_message_count($channel, $minutes);
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    36
    foreach ( $datum as &$pct )
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    37
    {
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    38
      $pct = $pct * $count;
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    39
    }
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    40
    $output = array(
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    41
        'result' => 'success',
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    42
        'minutes' => $minutes,
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    43
        'message_count' => $count,
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    44
        'active_users' => $datum
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    45
      );
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    46
    $result = $formatter->encode($output);
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    47
    if ( $format == 'xml' )
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    48
    {
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    49
      $activeusers = '<activeusers>';
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    50
      foreach ( $datum as $nick => $count )
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    51
      {
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    52
        $activeusers .= '<user nick="' . htmlspecialchars($nick) . '" count="' . $count . '" />';
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    53
      }
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    54
      $activeusers .= '</activeusers>';
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    55
      $result = preg_replace('#<activeusers>(.*?)</activeusers>#', $activeusers, $result);
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    56
    }
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    57
    echo $result;
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    58
    break;
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    59
}
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    60
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    61
/** FUNCTIONS **/
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    62
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    63
function die_in_output_format($message)
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    64
{
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    65
  global $formatter;
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    66
  echo $formatter->encode(array(
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    67
      'result' => 'error',
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    68
      'error' => $message
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    69
    ));
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    70
  exit;
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    71
}
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    72
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    73
/** FORMATS **/
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    74
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    75
class format_json
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    76
{
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    77
  public function encode($data)
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    78
  {
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    79
    require_once('../libjson.php');
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    80
    return eb_json_encode($data);
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    81
  }
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    82
  public function send_headers()
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    83
  {
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    84
    header('Content-type: text/javascript');
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    85
  }
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    86
}
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    87
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    88
/**
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    89
 * From <http://snipplr.com/view/3491/convert-php-array-to-xml-or-simple-xml-object-if-you-wish/>.
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    90
 */
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    91
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    92
class format_xml
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    93
{
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    94
	/**
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    95
	 * The main function for converting to an XML document.
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    96
	 * Pass in a multi dimensional array and this recrusively loops through and builds up an XML document.
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    97
	 *
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    98
	 * @param array $data
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
    99
	 * @param string $rootNodeName - what you want the root node to be - defaultsto data.
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
   100
	 * @param SimpleXMLElement $xml - should only be used recursively
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
   101
	 * @return string XML
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
   102
	 */
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
   103
	public static function toXml($data, $rootNodeName = 'response', $xml = null)
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
   104
	{
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
   105
		// turn off compatibility mode as simple xml throws a wobbly if you don't.
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
   106
		if (ini_get('zend.ze1_compatibility_mode') == 1)
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
   107
		{
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
   108
			ini_set ('zend.ze1_compatibility_mode', 0);
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
   109
		}
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
   110
		
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
   111
		if ($xml == null)
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
   112
		{
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
   113
			$xml = simplexml_load_string("<?xml version='1.0' encoding='utf-8'?><$rootNodeName />");
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
   114
		}
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
   115
		
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
   116
		// loop through the data passed in.
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
   117
		foreach($data as $key => $value)
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
   118
		{
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
   119
			// no numeric keys in our xml please!
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
   120
			if (is_numeric($key))
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
   121
			{
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
   122
				// make string key...
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
   123
				$key = "unknownNode_". (string) $key;
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
   124
			}
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
   125
			
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
   126
			// replace anything not alpha numeric
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
   127
			$key = preg_replace('/[^a-z0-9]/i', '', $key);
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
   128
			
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
   129
			// if there is another array found recrusively call this function
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
   130
			if (is_array($value))
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
   131
			{
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
   132
				$node = $xml->addChild($key);
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
   133
				// recrusive call.
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
   134
				format_xml::toXml($value, $rootNodeName, $node);
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
   135
			}
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
   136
			else 
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
   137
			{
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
   138
				// add single node.
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
   139
        $value = htmlentities($value);
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
   140
				$xml->addChild($key,$value);
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
   141
			}
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
   142
			
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
   143
		}
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
   144
		// pass back as string. or simple xml object if you want!
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
   145
		return $xml->asXML();
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
   146
	}
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
   147
  
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
   148
  public function encode($data)
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
   149
  {
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
   150
    return format_xml::toXml($data);
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
   151
  }
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
   152
  
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
   153
  public function send_headers()
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
   154
  {
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
   155
    header('Content-type: text/xml');
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
   156
  }
a7d884914a74 Added extern script to allow exporting some stats through a JSON or XML API. WiP.
Dan
parents:
diff changeset
   157
}