root/trunk/includes/pages/mynodes/mynodes_dnsnameserver.php @ 1

Revision 1, 2.2 kB (checked in by Winner, 5 years ago)

Initial import

Line 
1<?php
2/*
3 * WiND - Wireless Nodes Database
4 *
5 * Copyright (C) 2005 Nikolaos Nikalexis <winner@cube.gr>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 dated June, 1991.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19 *
20 */
21
22class mynodes_dnsnameserver {
23
24        var $tpl;
25       
26        function mynodes_dnsnameserver() {
27               
28        }
29       
30        function form_nameserver() {
31                global $db, $vars;
32                $form_nameserver = new form(array('FORM_NAME' => 'form_nameserver'));
33                $form_nameserver->db_data('dns_nameservers.name'.(get('nameserver') == 'add'?", dns_nameservers.ip":""));
34                $form_nameserver->db_data_values("dns_nameservers", "id", get('nameserver'));
35                return $form_nameserver;
36        }
37       
38        function output() {
39                if ($_SERVER['REQUEST_METHOD'] == 'POST' && method_exists($this, 'output_onpost_'.$_POST['form_name'])) return call_user_func(array($this, 'output_onpost_'.$_POST['form_name']));
40                global $construct;
41                $this->tpl['nameserver_method'] = (get('nameserver') == 'add' ? 'add' : 'edit' );
42                $this->tpl['form_nameserver'] = $construct->form($this->form_nameserver(), __FILE__);
43                return template($this->tpl, __FILE__);
44        }
45
46        function output_onpost_form_nameserver() {
47                global $construct, $main, $db;
48                $form_nameserver = $this->form_nameserver();
49                $nameserver = get('nameserver');
50                if (get('nameserver') == 'add') {
51                        $f['date_in'] = date_now();
52                        $_POST['dns_nameservers__ip'] = ip2long($_POST['dns_nameservers__ip']);
53                }
54                $f['node_id'] = get('node');
55                $ret = TRUE;
56                $ret = $form_nameserver->db_set($f,
57                                                                "dns_nameservers", "id", $nameserver);
58               
59                if ($ret) {
60                        $main->message->set_fromlang('info', 'request_dnsnameserver_success', makelink("", TRUE));
61                } else {
62                        $main->message->set_fromlang('error', 'generic');               
63                }
64        }
65
66}
67
68?>
Note: See TracBrowser for help on using the browser.