root / rpc.php

View | Annotate | Download (3.3 KB)

1
<?php
2
3
/***************************************************************************
4
 *
5
 * Nephthys - file sharing management
6
 * Copyright (c) by Andreas Unterkircher, unki@netshadow.at
7
 *
8
 *  This file is part of Nephthys.
9
 *
10
 *  Nephthys is free software: you can redistribute it and/or modify
11
 *  it under the terms of the GNU General Public License as published by
12
 *  the Free Software Foundation, either version 3 of the License, or
13
 *  (at your option) any later version.
14
 *
15
 *  Nephthys is distributed in the hope that it will be useful,
16
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
 *  GNU General Public License for more details.
19
 *
20
 *  You should have received a copy of the GNU General Public License
21
 *  along with Nephthys. If not, see <http://www.gnu.org/licenses/>.
22
 *
23
 ***************************************************************************/
24
25
require_once "nephthys.class.php";
26
27
class NEPHTHYS_RPC {
28
29
   public function __construct()
30
   {
31
      session_start();
32
33
   } // __construct()
34
35
   public function process_ajax_request()
36
   {
37
      require_once 'HTML/AJAX/Server.php';
38
39
      $server = new HTML_AJAX_Server();
40
      $server->handleRequest();
41
42
      /* was there only an init call, then stop */
43
      if($_GET['mode'] == 'init' && $_GET['client'] == 'all')
44
         return true;
45
46
      define("RPC_CALL", uniqid());
47
48
      $nephthys = new NEPHTHYS();
49
50
      // if no action has been specified we are going to redirect
51
      // this request to Nephthys start page.
52
      if(!isset($_GET['action']) && !isset($_POST['action'])) {
53
         Header("Location: ". $nephthys->cfg->web_path);
54
         return;
55
      }
56
57
      if(isset($_GET['action']))
58
         $action = $_GET['action'];
59
      if(isset($_POST['action']))
60
         $action = $_POST['action'];
61
62
      switch($action) {
63
         case 'get_content':
64
            print $nephthys->get_content();
65
            break;
66
         case 'get_menu':
67
            print $nephthys->get_menu();
68
            break;
69
         case 'store':
70
            print $nephthys->store();
71
            break;
72
         case 'login':
73
            print $nephthys->login();
74
            break;
75
         case 'logout':
76
            print $nephthys->logout();
77
            break;
78
         case 'notifybucket':
79
            print $nephthys->notifybucket();
80
            break;
81
         case 'deletebucket':
82
            print $nephthys->delete_bucket();
83
            break;
84
         case 'validateemail':
85
            if(isset($_POST['address']) && !empty($_POST['address']) && $nephthys->is_valid_email($_POST['address']))
86
               print "ok";
87
            else
88
               print "failed";
89
            break;
90
         case 'sortorder':
91
            print $nephthys->update_sort_order();
92
            break;
93
         case 'getxmllist':
94
            print $nephthys->get_xml_list();
95
            break;
96
         case 'get_bucket_info':
97
            print $nephthys->get_bucket_info();
98
            break;
99
         case 'filemgr':
100
            print $nephthys->load_filemgr();
101
            break;
102
         default:
103
            print "unkown action ". $action;
104
            break;
105
      }
106
107
   } // process_ajax_request();
108
109
} // class NEPHTHYS_RPC
110
111
$rpc = new NEPHTHYS_RPC();
112
$rpc->process_ajax_request();
113
114
// vim: set filetype=php expandtab softtabstop=3 tabstop=3 shiftwidth=3 autoindent smartindent:
115
?>
116