/dev/adei-asec

To get this branch, use:
bzr branch http://darksoft.org/webbzr/dev/adei-asec

« back to all changes in this revision

Viewing changes to patches/riku-weather/services/riku.php

  • Committer: Suren A. Chilingaryan
  • Date: 2012-07-14 17:44:09 UTC
  • Revision ID: csa@dside.dyndns.org-20120714174409-cuzsy4vupyjx9lia
Update of setups

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<?php
2
 
    header("Content-type: text/xml");
3
 
    header("Cache-Control: no-cache, must-revalidate");
4
 
    header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
5
 
 
6
 
    if(isset($_GET["start"]))
7
 
    {
8
 
        $start = $_GET["start"];
9
 
    }
10
 
    else 
11
 
    {
12
 
        $start = 1;
13
 
    }
14
 
    if(isset($_GET["zoom"]))
15
 
    {
16
 
        $zoom = $_GET["zoom"];
17
 
    }
18
 
    else
19
 
    {
20
 
        $zoom = 1;
21
 
    }
22
 
    if(isset($_GET["pic_id"]))
23
 
    {
24
 
        $id = $_GET["pic_id"];
25
 
    }
26
 
    else
27
 
    {
28
 
        $id = 1;
29
 
    }
30
 
    if(isset($_GET["image_target"]))
31
 
    {
32
 
        $target = $_GET["image_target"];
33
 
    }
34
 
    else
35
 
    {
36
 
        $target = "cloud";
37
 
    }
38
 
    
39
 
    $window = $_GET["window"];
40
 
    
41
 
    $image = "http://ipepdvadei2.ka.fzk.de/riku/services/imageservices.php?target=" . $target . "_main&amp;start=$start&amp;n=$zoom&amp;window=$window"; 
42
 
    $image2 = "http://ipepdvadei2.ka.fzk.de/riku/services/imageservices.php?target=" . $target . "_sec&amp;id=$id"; 
43
 
    
44
 
    //here we determine the start slider's maximum value
45
 
    if($target === "cloud")
46
 
    {
47
 
        $dir = "/home/riku/small/";
48
 
 
49
 
        $data_amount = 0;
50
 
    
51
 
        if (is_dir($dir)) 
52
 
        {
53
 
            if ($handle = opendir($dir)) {
54
 
                while (false !== ($file = readdir($handle))) {
55
 
                    if(strstr($file, "kitcube"))
56
 
                    {
57
 
                        $data_amount++;
58
 
                    }
59
 
                }
60
 
            }
61
 
        }
62
 
        closedir($handle);
63
 
        
64
 
        $start_slider_max = 1;
65
 
        $data_dummy = $data_amount;
66
 
        while($data_dummy > 100)
67
 
        {
68
 
            $data_dummy = floor($data_dummy / 10);
69
 
            $start_slider_max = $start_slider_max * 10;
70
 
        }
71
 
        
72
 
    }
73
 
    /*
74
 
        TODO:Implementation for finding the slider maximum value for other services
75
 
    */
76
 
    else if($target === "ceilo")
77
 
    {
78
 
        $start_slider_max = 500;
79
 
    }
80
 
    else
81
 
    {
82
 
        $start_slider_max = 100;
83
 
    }
84
 
 
85
 
    //contruct result XML and print it
86
 
    $xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
87
 
    $xml .= "<result>
88
 
                <image>$image</image>
89
 
                <image2>$image2</image2>
90
 
                <window>$window</window>
91
 
                <zoom>$zoom</zoom>
92
 
                <start>$start</start>
93
 
                <id>$id</id>
94
 
                <start_slider_max>$start_slider_max</start_slider_max>
95
 
                <data_amount>$data_amount</data_amount>
96
 
            </result>";
97
 
 
98
 
    echo $xml;
99
 
 
100
 
//endoffile
 
 
b'\\ No newline at end of file'