Subversion Repositories HomeAutomation

Rev

Rev 2068 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed

Rev 2068 Rev 2073
1
<?php
1
<?php
2
 
2
 
3
require_once("config.php");
3
require_once("config.php");
-
 
4
 
-
 
5
if ($atomdOld)
-
 
6
{
4
require_once("atom_interface.php");
7
  require_once("atom_interface_old.php");
-
 
8
}
-
 
9
else
-
 
10
{
-
 
11
  require_once("atom_interface_new.php");
-
 
12
}
-
 
13
 
5
 
14
 
6
function GetSubfolders($directory)
15
function GetSubfolders($directory)
7
{
16
{
8
  $folders = array();
17
  $folders = array();
9
 
18
 
10
  if (file_exists($directory))
19
  if (file_exists($directory))
11
  {
20
  {
12
    $directory_handle = opendir($directory);
21
    $directory_handle = opendir($directory);
13
 
22
 
14
    while (false !== ($filename = readdir($directory_handle)))
23
    while (false !== ($filename = readdir($directory_handle)))
15
    {
24
    {
16
      if (is_dir($directory . "/" . $filename) && $filename[0] != ".")
25
      if (is_dir($directory . "/" . $filename) && $filename[0] != ".")
17
      {
26
      {
18
        $folders[] = $filename;
27
        $folders[] = $filename;
19
      }
28
      }
20
    }
29
    }
21
 
30
 
22
    closedir($directory_handle);
31
    closedir($directory_handle);
23
 
32
 
24
    if (count($folders) > 0)
33
    if (count($folders) > 0)
25
    {
34
    {
26
      natcasesort($folders);
35
      natcasesort($folders);
27
      $folders = array_values($folders);
36
      $folders = array_values($folders);
28
    }
37
    }
29
  }
38
  }
30
 
39
 
31
  return $folders;
40
  return $folders;
32
}
41
}
33
 
42
 
34
if (isset($_GET["ajax"]))
43
if (isset($_GET["ajax"]))
35
{
44
{
36
  global $atomdHostname;
45
  global $atomdHostname;
37
  global $atomdPort;
46
  global $atomdPort;
38
 
47
 
39
  $buffer = "";
48
  $buffer = "";
40
 
49
 
41
  try
50
  try
42
  {
51
  {
43
    $socket = atomd_initialize($atomdHostname, $atomdPort);
52
    $socket = atomd_initialize($atomdHostname, $atomdPort);
44
 
53
 
45
    atomd_send_command($socket, $_GET["command"]);
54
    atomd_send_command($socket, $_GET["command"]);
46
 
55
 
47
    echo trim(atomd_read_command_response($socket));
56
    echo trim(atomd_read_command_response($socket));
48
  }
57
  }
49
  catch (Exception $e)
58
  catch (Exception $e)
50
  {
59
  {
51
    die($e);
60
    die($e);
52
  }
61
  }
53
 
62
 
54
  exit(0);  
63
  exit(0);  
55
}
64
}
56
else
65
else
57
{
66
{
58
  $pages = GetSubfolders("pages/");
67
  $pages = GetSubfolders("pages/");
59
}
68
}
60
 
69
 
61
?>
70
?>