From 524fd2d0ee134f86eaf1cc3aa433778327a699be Mon Sep 17 00:00:00 2001 From: Mark Huang Date: Thu, 9 Nov 2006 20:21:43 +0000 Subject: [PATCH] implemented api query filters --- blacklist.php | 4 ++-- bwlimit.php | 4 ++-- getupdatesxml.php | 4 ++-- keys.php | 4 ++-- ntp.conf.php | 4 ++-- ntp/step-tickers.php | 6 ++++-- proxies.php | 4 ++-- sysctl.php | 4 ++-- 8 files changed, 18 insertions(+), 16 deletions(-) diff --git a/blacklist.php b/blacklist.php index d04e4c6..d3ffaa6 100755 --- a/blacklist.php +++ b/blacklist.php @@ -9,7 +9,7 @@ # Mark Huang # Copyright (C) 2004 The Trustees of Princeton University # -# $Id: blacklist.php,v 1.5 2005/10/04 18:04:59 alk Exp $ +# $Id: blacklist.php,v 1.1 2006/11/06 22:02:17 mlhuang Exp $ # *filter @@ -22,7 +22,7 @@ require_once 'plc_api.php'; global $adm; // Look up the node -$nodenetworks = $adm->GetNodeNetworks(array($_SERVER['REMOTE_ADDR'])); +$nodenetworks = $adm->GetNodeNetworks(array('ip' => $_SERVER['REMOTE_ADDR'])); if (!empty($nodenetworks)) { $nodes = $adm->GetNodes(array($nodenetworks[0]['node_id'])); if (!empty($nodes)) { diff --git a/bwlimit.php b/bwlimit.php index 4c6e07b..0b554da 100755 --- a/bwlimit.php +++ b/bwlimit.php @@ -5,7 +5,7 @@ // Mark Huang // Copyright (C) 2006 The Trustees of Princeton University // -// $Id$ +// $Id: bwlimit.php,v 1.1 2006/11/06 22:02:17 mlhuang Exp $ // // Get admin API handle @@ -13,7 +13,7 @@ require_once 'plc_api.php'; global $adm; // Look up the node -$nodenetworks = $adm->GetNodeNetworks(array($_SERVER['REMOTE_ADDR'])); +$nodenetworks = $adm->GetNodeNetworks(array('ip' => $_SERVER['REMOTE_ADDR'])); if (!empty($nodenetworks)) { if ($nodenetworks[0]['bwlimit'] !== NULL) { $rate = $nodenetworks[0]['bwlimit']; diff --git a/getupdatesxml.php b/getupdatesxml.php index 9acc834..e4bd286 100755 --- a/getupdatesxml.php +++ b/getupdatesxml.php @@ -7,7 +7,7 @@ // // Copyright (C) 2006 The Trustees of Princeton University // -// $Id$ +// $Id: getupdatesxml.php,v 1.1 2006/11/06 22:02:17 mlhuang Exp $ // // Get admin API handle @@ -80,7 +80,7 @@ function xmlspecialchars($string, $parsed = ENT_UNPARSED) if (!empty($_REQUEST['node_id'])) { $nodes = $adm->GetSlivers(array(intval($_REQUEST['node_id']))); } else { - $nodenetworks = $adm->GetNodeNetworks(array($_SERVER['REMOTE_ADDR'])); + $nodenetworks = $adm->GetNodeNetworks(array('ip' => $_SERVER['REMOTE_ADDR'])); if (!empty($nodenetworks)) { $nodes = $adm->GetSlivers(array($nodenetworks[0]['node_id'])); } diff --git a/keys.php b/keys.php index 38b04e9..dd2e24a 100755 --- a/keys.php +++ b/keys.php @@ -13,7 +13,7 @@ // Aaron Klingaman // Copyright (C) 2004 The Trustees of Princeton University // -// $Id: keys.php,v 1.8 2005/10/04 18:11:26 alk Exp $ +// $Id: keys.php,v 1.1 2006/11/06 22:02:17 mlhuang Exp $ // // Get admin API handle @@ -36,7 +36,7 @@ if (!empty($_REQUEST['role'])) { if (isset($_REQUEST['site_admin'])) { // Look up the node - $nodenetworks = $adm->GetNodeNetworks(array($_SERVER['REMOTE_ADDR'])); + $nodenetworks = $adm->GetNodeNetworks(array('ip' => $_SERVER['REMOTE_ADDR'])); if (!empty($nodenetworks)) { $nodes = $adm->GetNodes(array($nodenetworks[0]['node_id'])); if (!empty($nodes)) { diff --git a/ntp.conf.php b/ntp.conf.php index 4b28145..6a05587 100755 --- a/ntp.conf.php +++ b/ntp.conf.php @@ -5,7 +5,7 @@ // Marc Fiuczynski // Copyright (C) 2006 The Trustees of Princeton University // -// $Id$ +// $Id: ntp.conf.php,v 1.1 2006/11/06 22:02:17 mlhuang Exp $ // // Get admin API handle @@ -18,7 +18,7 @@ $default_name = "default"; $file_name = $config_directory . $file_prefix . $default_name; // Look up the node -$nodenetworks = $adm->GetNodeNetworks(array($_SERVER['REMOTE_ADDR'])); +$nodenetworks = $adm->GetNodeNetworks(array('ip' => $_SERVER['REMOTE_ADDR'])); if (!empty($nodenetworks)) { $nodes = $adm->GetNodes(array($nodenetworks[0]['node_id'])); if (!empty($nodes)) { diff --git a/ntp/step-tickers.php b/ntp/step-tickers.php index bcdc90b..f667745 100755 --- a/ntp/step-tickers.php +++ b/ntp/step-tickers.php @@ -5,7 +5,7 @@ // Marc Fiuczynski // Copyright (C) 2006 The Trustees of Princeton University // -// $Id$ +// $Id: step-tickers.php,v 1.1 2006/11/06 22:02:17 mlhuang Exp $ // // Get admin API handle @@ -18,7 +18,7 @@ $default_name = "default"; $file_name = $config_directory . $file_prefix . $default_name; // Look up the node -$nodenetworks = $adm->GetNodeNetworks(array($_SERVER['REMOTE_ADDR'])); +$nodenetworks = $adm->GetNodeNetworks(array('ip' => $_SERVER['REMOTE_ADDR'])); if (!empty($nodenetworks)) { $nodes = $adm->GetNodes(array($nodenetworks[0]['node_id'])); if (!empty($nodes)) { @@ -31,6 +31,8 @@ if (!isset($node)) { exit(); } +$hostname= trim($node['hostname']); + /* Look for config file */ $hostname_bits = explode('.', $hostname); diff --git a/proxies.php b/proxies.php index 4a1dedd..e54fc44 100755 --- a/proxies.php +++ b/proxies.php @@ -9,7 +9,7 @@ # Mark Huang # Copyright (C) 2004 The Trustees of Princeton University # -# $Id: proxies.php,v 1.8 2005/10/07 17:55:41 mlhuang Exp $ +# $Id: proxies.php,v 1.1 2006/11/06 22:02:17 mlhuang Exp $ # GetNodeNetworks(array($_SERVER['REMOTE_ADDR'])); +$nodenetworks = $adm->GetNodeNetworks(array('ip' => $_SERVER['REMOTE_ADDR'])); if (!empty($nodenetworks)) { $nodes = $adm->GetNodes(array($nodenetworks[0]['node_id'])); if (!empty($nodes)) { diff --git a/sysctl.php b/sysctl.php index e0120ed..554f0dd 100755 --- a/sysctl.php +++ b/sysctl.php @@ -5,7 +5,7 @@ // Mark Huang // Copyright (C) 2006 The Trustees of Princeton University // -// $Id$ +// $Id: sysctl.php,v 1.1 2006/11/06 22:02:17 mlhuang Exp $ // // Get admin API handle @@ -15,7 +15,7 @@ global $adm; $ip_forward = 0; // Look up the node -$nodenetworks = $adm->GetNodeNetworks(array($_SERVER['REMOTE_ADDR'])); +$nodenetworks = $adm->GetNodeNetworks(array('ip' => $_SERVER['REMOTE_ADDR'])); if (!empty($nodenetworks)) { $nodes = $adm->GetNodes(array($nodenetworks[0]['node_id'])); if (!empty($nodes)) { -- 2.43.0