コード例 #1
0
function extractkml()
{
    global $argc, $argv, $kmlname;
    if ($argc != 4) {
        usage();
    }
    $id = $argv[3];
    if (!preg_match('/^\\d+$/', $id)) {
        usage();
    }
    $file = $argv[2];
    if (file_exists($file)) {
        $xml = @simplexml_load_file($file);
    } else {
        file_not_found($file);
    }
    if ($xml === false) {
        bad_xml($file);
    }
    $nodes = $xml->node;
    foreach ($nodes as $node) {
        $nt[(string) $node->attributes()->id] = array((double) $node->attributes()->lon, (double) $node->attributes()->lat);
    }
    $geoms = array();
    // find relations with the given id
    $relationmembers = array();
    $relations = $xml->relation;
    foreach ($relations as $relation) {
        $c2cid = c2cid($relation);
        if ($c2cid && in_array($id, $c2cid)) {
            kmlname($relation, $id);
            $relationid = (string) $relation->attributes()->id;
            $geoms[$relationid] = array();
            // we suppose we only have members of type way
            // but a way can be linked to more than one relation (and vice versa)
            $members = $relation->member;
            foreach ($members as $member) {
                $memberref = (string) $member->attributes()->ref;
                if (!isset($relationmembers[$memberref][$relationid])) {
                    $relationmembers[$memberref][$relationid] = (string) $member->attributes()->role;
                }
            }
        }
    }
    $ways = $xml->way;
    foreach ($ways as $way) {
        // check that either way is a polygon of the c2c area
        $c2cid = c2cid($way);
        $wayid = (string) $way->attributes()->id;
        if ($c2cid && in_array($id, $c2cid)) {
            kmlname($way, $id);
            $geoms[] = get_nodes($way, $nt);
        }
        // or a border for a relation
        if (isset($relationmembers[$wayid])) {
            foreach ($relationmembers[$wayid] as $relationid => $role) {
                $geoms[$relationid][$role][] = get_nodes($way, $nt);
            }
        }
    }
    if (count($geoms)) {
        kmlstart();
        if (count($geoms) > 1) {
            echo '    <MultiGeometry>', "\n";
        }
        foreach ($geoms as $geom) {
            echo '      <Polygon>', "\n";
            if (!isset($geom['outer'])) {
                kmlboundary($geom);
            } else {
                kmlboundary($geom['outer'][0]);
                foreach ($geom['inner'] as $b) {
                    kmlboundary($b, 'inner');
                }
            }
            echo '      </Polygon>', "\n";
        }
        if (count($geoms) > 1) {
            echo '    </MultiGeometry>', "\n";
        }
        kmlend();
    }
}
コード例 #2
0
ファイル: dht.php プロジェクト: DeepSkyFire/rssindexer
/**
 * 处理get_peers请求
 * @param  array $msg     接收到的get_peers请求数据
 * @param  array $address 对端链接信息
 * @return void
 */
function on_get_peers($msg, $address)
{
    global $nid;
    //write(date('Y-m-d H:i:s', time()) . " on_get_peers\n");
    // 获取info_hash信息
    $infohash = $msg['a']['info_hash'];
    // 获取node id
    $id = $msg['a']['id'];
    // 生成回复数据
    $msg = array('t' => $msg['t'], 'y' => 'r', 'r' => array('id' => $nid, 'nodes' => Base::encode_nodes(get_nodes()), 'token' => substr($infohash, 0, 2)));
    // 将node加入路由表
    append(new Node($id, $address[0], $address[1]));
    // 向对端发送回复数据
    send_response($msg, $address);
}
コード例 #3
0
ファイル: utils.php プロジェクト: jhbsz/ossimTest
function get_nodes($tree, $node_name)
{
    $nodes = null;
    if (is_array($tree)) {
        foreach ($tree as $k => $v) {
            if (is_array($v) && $k === $node_name) {
                $nodes[] = $v;
            } else {
                if (is_array($v) && $k !== $node_name) {
                    $aux = get_nodes($v, $node_name);
                    $nodes = is_array($nodes) ? $nodes : array();
                    $aux = is_array($aux) ? $aux : array();
                    $nodes = array_merge($nodes, $aux);
                }
            }
        }
    }
    return $nodes;
}
コード例 #4
0
ファイル: shiftedit-proxy.php プロジェクト: nsbawden/dac-atom
     echo json_encode($response);
     break;
 case 'get':
     if ($_POST['path'] and substr($_POST['path'], -1) !== '/') {
         $_POST['path'] .= '/';
     }
     $files = array();
     if ($_POST['path'] == '/') {
         $_POST['path'] = '';
     }
     if ($_POST['path'] == '' and $_GET['path']) {
         //used by save as
         $files = get_nodes($_POST['path'], array(dirname($_GET['path']) . '/'));
     } else {
         //preload paths
         $files = get_nodes($_POST['path'], $_SESSION['paths']);
     }
     //include root
     if ($_POST['path'] == '' and $_GET['root'] === 'false') {
         $root[0] = array('text' => $site['dir'], 'iconCls' => 'folder', 'disabled' => false, 'leaf' => false, 'modified' => '', 'size' => '', 'expanded' => true, 'children' => $files);
         $files = $root;
     }
     echo json_encode($files);
     break;
 case 'list':
     if ($_POST['path'] and substr($_POST['path'], -1) !== '/') {
         $_POST['path'] .= '/';
     }
     $server_src = $server;
     $response = array();
     $response['success'] = true;
コード例 #5
0
ファイル: load_config_tab.php プロジェクト: jhbsz/ossimTest
        $directories = get_nodes($syscheck, 'directories');
        $wentries = get_nodes($syscheck, 'windows_registry');
        $reg_ignores = get_nodes($syscheck, 'registry_ignore');
        $ignores = get_nodes($syscheck, 'ignore');
        $frequency = get_nodes($syscheck, 'frequency');
        $frequency = $frequency[0][0];
        $scan_day = get_nodes($syscheck, 'scan_day');
        $scan_day = $scan_day[0][0];
        $scan_time = get_nodes($syscheck, 'scan_time');
        $scan_time = $scan_time[0][0];
        $st = !empty($scan_time) ? explode(":", $scan_time) : array();
        $auto_ignore = get_nodes($syscheck, 'auto_ignore');
        $auto_ignore = empty($auto_ignore[0][0]) ? "no" : $auto_ignore[0][0];
        $alert_new_files = get_nodes($syscheck, 'alert_new_files');
        $alert_new_files = empty($alert_new_files[0][0]) ? "no" : $alert_new_files[0][0];
        $scan_on_start = get_nodes($syscheck, 'scan_on_start');
        $scan_on_start = empty($scan_on_start[0][0]) ? "yes" : $scan_on_start[0][0];
        $directory_checks = array("realtime" => "Realtime", "report_changes" => "Report changes", "check_all" => "Chk all", "check_sum" => "Chk sum", "check_sha1sum" => "Chk sha1sum", "check_size" => "Chk size", "check_owner" => "Chk owner", "check_group" => "Chk group", "check_perm" => "Chk perm");
        $week_days = array("" => "-- Select a day --", "monday" => "Monday", "tuesday" => "Tuesday", "wednesday" => "Wednesday", "thursday" => "Thursday", "friday" => "Friday", "saturday" => "Saturday", "sunday" => "Sunday");
        $yes_no = array("yes" => "Yes", "no" => "No");
        echo "1###";
        ?>
	<form name='form_syscheck' id='form_syscheck'>
	
		<div class='cont_sys'>
			<div class='headerpr'><?php 
        echo _("Configuration parameters");
        ?>
</div>
			<div id='cont_tsp'>
				<table id='table_sys_parameters'>
コード例 #6
0
ファイル: index.php プロジェクト: 4x4falcon/browse
    echo '
   </td>
   </tr>';
}
?>


<?php 
if ($object_type == 'way') {
    echo '
   <tr valign="top">
   <td id="left">
   Nodes:
   </td>
   <td id="right">';
    echo get_nodes($object->{$object_type});
    echo '
   </td>
   </tr>';
}
?>

<?php 
if ($object_type == 'relation') {
    $tmp = get_members($object->{$object_type});
    if ($tmp != '') {
        echo '
   <tr valign="top">
   <td id="left">
   Ways:
   </td>
コード例 #7
0
ファイル: download.php プロジェクト: saintho/phpdisk
#	Copyright (C) 2008-2014 PHPDisk Team. All Rights Reserved.
#
*/
include "includes/commons.inc.php";
$in_front = true;
$file_id = (int) gpc('file_id', 'GP', 0);
$num = @$db->result_first("select count(*) from {$tpf}files where file_id='{$file_id}' and is_del=0");
if (!$num) {
    header("Location: ./");
    exit;
}
$file = curr_file($file_id);
$title = $file['file_name'] . ' - ' . $settings['site_title'];
$mycp = $file['username_a'] == $pd_username ? 1 : 0;
$myinfo = get_profile($file[userid]);
$nodes = get_nodes($file[server_oid]);
if ($auth[is_fms]) {
    $C[you_like_file] = super_cache::get('get_rand_file|10');
}
if (get_profile($file[userid], 'plan_id')) {
    $adv_top = stripslashes(base64_decode(get_plans(get_profile($file[userid], 'plan_id'), 'download_code_top')));
    $adv_inner = stripslashes(base64_decode(get_plans(get_profile($file[userid], 'plan_id'), 'download_code_left')));
    $adv_bottom = stripslashes(base64_decode(get_plans(get_profile($file[userid], 'plan_id'), 'download_code_bottom')));
} else {
    $adv_top = show_adv_data('adv_download_top', 0);
    $adv_inner = show_adv_data('adv_download_inner', 0);
    $adv_bottom = show_adv_data('adv_download_bottom', 0);
}
if ($auth[pd_a]) {
    $seo = get_seo('download', $file_id);
    $seo_a = get_seo('download', 0);
コード例 #8
0
ファイル: data.php プロジェクト: ericho/spark_edison
    }
    return $res_array;
}
function get_last_data($nodes, $type_mea)
{
    /* The user must specify the type of measurement that wants to query */
    $meas = array();
    foreach ($nodes as $node) {
        $node_id = $node['id'];
        $query = "SELECT * FROM meas WHERE node_id =" . $node_id . " and type_mea = " . $type_mea . " ORDER by id DESC LIMIT 1";
        $res = mysql_query($query);
        $row = mysql_fetch_array($res);
        $tmp_array = array("id" => $row[0], "node_id" => $row[1], "date" => $row[2], "mea" => $row[3], "type_mea" => $row[4]);
        array_push($meas, $tmp_array);
    }
    return $meas;
}
if (!isset($_GET['nodes']) && !isset($_GET['data'])) {
    echo "Action not specified";
}
$con = connect_db();
if (isset($_GET['nodes'])) {
    echo json_encode(get_nodes());
} else {
    if (isset($_GET['data'])) {
        $type_data = $_GET['data'];
        $nodes = get_nodes();
        $data = get_last_data($nodes, $type_data);
        echo json_encode($data);
    }
}