function getSyncLists($client_kmls, $kml_data_file)
{
    $new_kml_list = getKmlListUrls($kml_data_file);
    $add_list = array_diff_key($new_kml_list, $client_kmls);
    $delete_list = array_diff_key($client_kmls, $new_kml_list);
    $keep_list = array_intersect_key($client_kmls, $new_kml_list);
    return array($add_list, $delete_list, $keep_list);
}
function syncTouchscreenChoices($kml_data_file)
{
    $touch_kml = trim(getOrDefault('touch_kml', ''));
    $touch_action = getOrDefault('touch_action', '');
    $kml_url_list = getKmlListUrls($kml_data_file);
    # If delete action, remove element from array
    if ($touch_action == 'delete' && in_array($touch_kml, $kml_url_list)) {
        $index = array_search($touch_kml, $kml_url_list);
        unset($kml_url_list[$index]);
        writeKmlListFile($kml_data_file, $kml_url_list);
    } else {
        if ($touch_action == 'add' && !in_array($touch_kml, $kml_url_list)) {
            $kml_url_list[md5($touch_kml)] = $touch_kml;
            writeKmlListFile($kml_data_file, $kml_url_list);
        }
    }
}
Exemple #3
0
    fclose($handle);
}
#LG server
$KML_SYS_PATH = '/var/www/kml/';
$KML_SERVER_BASE = 'http://lg1:81/kml/';
$FILE_FILTER = '*.km[l|z]';
$kml_files = array('earth' => array(), 'moon' => array(), 'mars' => array(), 'layers' => array());
foreach (array_keys($kml_files) as $planet) {
    $planet_kml_path = $KML_SYS_PATH . $planet . "/" . $FILE_FILTER;
    foreach (glob($planet_kml_path) as $file) {
        $basename = str_replace('_', ' ', explode('.', basename($file)));
        $kml_files[$planet][$basename[0]] = str_replace($KML_SYS_PATH, $KML_SERVER_BASE, $file);
    }
}
$kml_data_file = 'kmls.txt';
$existing_kml_url_list = array_values(getKmlListUrls($kml_data_file));
?>
<html>
  <head>
    <link rel="stylesheet" type="text/css" href="style.css" />
    <script type="text/javascript" src="javascript.js"></script>

    <script type="text/javascript">       
      function clearKmls() {
        showAndHideStatus();
        <?php 
$i = 0;
foreach (array_values($queries['layers']) as $layer) {
    ?>
          submitRequest('sync_touchscreen.php?touch_action=delete&touch_kml=<?php 
    echo $layer[1];