Example #1
0
 function output()
 {
     global $main, $construct, $vars, $lang;
     if ($this->hide) {
         return;
     }
     if (file_exists(ROOT_PATH . 'config/mylogo.png')) {
         $this->tpl['mylogo'] = TRUE;
         $this->tpl['mylogo_dir'] = ROOT_PATH . 'config/';
     }
     $this->tpl['link_home'] = make_ref('/');
     $this->tpl['link_login_form'] = make_ref('/users/loginform');
     $this->tpl['link_logout'] = make_ref('/users', array('action' => 'logout'));
     $this->tpl['current_language'] = $vars['info']['current_language'];
     $this->tpl['search_url'] = make_ref('/search');
     foreach ($vars['language']['enabled'] as $key => $value) {
         if ($value) {
             $this->tpl['languages'][$key]['name'] = $lang['languages'][$key] == '' ? $key : $lang['languages'][$key];
             $this->tpl['languages'][$key]['link'] = self_ref(array("session_lang" => $key));
         }
     }
     if ($main->userdata->logged) {
         $this->tpl['logged'] = $main->userdata->logged;
         $this->tpl['logged_username'] = isset($main->userdata->info['username']) ? $main->userdata->info['username'] : "";
         $this->tpl['logged_title'] = get_user_title();
         $this->tpl['link_user_profile'] = make_ref('/users', array("user" => $main->userdata->user));
     } else {
         $this->tpl['link_register'] = make_ref('/users', array("user" => "add"));
         $this->tpl['link_restore_password'] = make_ref('/users', array("action" => "restore"));
         $this->tpl['link_register'] = make_ref('/users', array("user" => "add"));
     }
     return template($this->tpl, __FILE__);
 }
Example #2
0
 function output_onpost_table_services()
 {
     global $db, $main;
     $ret = TRUE;
     foreach ((array) $_POST['id'] as $key => $value) {
         $ret = $ret && $db->del("services", '', "id = '" . $value . "'");
     }
     if ($ret) {
         $main->message->set_fromlang('info', 'delete_success', self_ref());
     } else {
         $main->message->set_fromlang('error', 'generic');
     }
 }
Example #3
0
 function table($table, $template = 'constructors/table.tpl')
 {
     global $smarty;
     if (substr(strrchr($template, "."), 1) != "tpl") {
         $path_parts = pathinfo($template);
         $tpl_file = 'includes' . substr($path_parts['dirname'], strpos($path_parts['dirname'], 'includes') + 8) . "/" . basename($path_parts['basename'], '.' . $path_parts['extension']) . '_' . $table->info['TABLE_NAME'] . '.tpl';
         if (file_exists($smarty->template_dir . $tpl_file)) {
             $template = $tpl_file;
         } else {
             $template = 'constructors/table.tpl';
         }
     }
     return template(array("data" => $table->data, "extra_data" => $table->info, "action_url" => self_ref()), $template);
 }
    function output_onpost_table_dns()
    {
        global $db, $main;
        $ret = TRUE;
        foreach ((array) $_POST['id'] as $key => $value) {
            $ret = $ret && $db->del("dns_zones, dns_zones_nameservers", 'dns_zones 
							LEFT JOIN dns_zones_nameservers ON dns_zones.id = dns_zones_nameservers.zone_id', "dns_zones.id = '" . intval($value) . "'");
        }
        if ($ret) {
            $main->message->set_fromlang('info', 'delete_success', self_ref());
        } else {
            $main->message->set_fromlang('error', 'generic');
        }
    }
 function output_onpost_form_zone_reverse()
 {
     global $db, $main, $vars;
     $ret = FALSE;
     $f = fopen($vars['dns']['reverse_zone_schema'], "w");
     if (fwrite($f, $_POST['schema']) !== FALSE) {
         $ret = TRUE;
     }
     fclose($f);
     if ($ret) {
         $main->message->set_fromlang('info', 'edit_success', self_ref());
     } else {
         $main->message->set_fromlang('error', 'generic');
     }
 }
 function output_onpost_table_ip_ranges_v6()
 {
     global $db, $main;
     $ret = TRUE;
     foreach ((array) $_POST['id'] as $key => $value) {
         $ret1 = TRUE;
         $ret1 = $db->get('v6net_id', 'ip_ranges_v6', "ip_ranges_v6.id = '" . $value . "'");
         $ret = $ret && $db->del("ip_ranges_v6", '', "id = '" . $value . "'");
         $ret2 = TRUE;
         $ret2 = $ret2 && $db->set("ipv6_node_repos", array('node_id' => '0'), "id = '" . $ret1[0]['v6net_id'] . "'");
     }
     if ($ret && $ret2) {
         $main->message->set_fromlang('info', 'delete_success', self_ref());
     } else {
         $main->message->set_fromlang('error', 'generic');
     }
 }
Example #7
0
 function output_onpost_login()
 {
     global $main, $lang;
     $result = array();
     if ($main->userdata->login($_POST['username'], $_POST['password'], isset($_POST['rememberme']) && $_POST['rememberme'] == 'Y' ? TRUE : FALSE)) {
         if ($main->userdata->info['status'] == 'pending') {
             $result['error'] = $lang['message']['infp']['activation_required'];
             $main->userdata->logout();
         } else {
             $result['success'] = $lang['message']['info']['login_success'];
             $main->message->set_fromlang('info', 'login_success', self_ref());
         }
     } else {
         $result['error'] = $lang['message']['error']['login_failed'];
     }
     header('Content-Type: application/json; ' . $lang['charset']);
     print json_encode($result);
     exit;
 }
Example #8
0
 function output_onpost_form_area()
 {
     global $construct, $main, $db;
     $form_area = $this->form_area();
     $area = get('area');
     $ret = TRUE;
     $_POST['areas__ip_start'] = ip2long($_POST['areas__ip_start']);
     $_POST['areas__ip_end'] = ip2long($_POST['areas__ip_end']);
     $_POST['areas__v6net'] = inet_pton($_POST['areas__v6net']);
     $ret = $form_area->db_set(array(), "areas", "id", get('area'));
     if (!$ret) {
         $main->message->set_fromlang('error', 'generic');
     }
     $dat = $db->get("areas.id AS id", "areas", "areas.name = '" . $_POST['areas__name'] . "'", "", "name ASC LIMIT 1");
     $areaid = $dat[0]['id'];
     $ipv6net = inet_ntop($_POST['areas__v6net']);
     $ipv6net = explode(':', $ipv6net, 4);
     if ($ipv6net[2] == '') {
         $ipv6net[2] = '0000';
     }
     $ipv6net[3] = '0000';
     for ($i = 0; $i < 65536; $i = $i + 256) {
         $ipv6net[3] = dechex($i);
         $ipv6net[4] = ':';
         $ipv6net2 = implode(':', $ipv6net);
         $ret2 = $db->add("ipv6_node_repos", array("v6net" => inet_pton($ipv6net2), "area_id" => $areaid));
         if (!$ret2) {
             $main->message->set_fromlang('error', 'generic');
         }
     }
     if ($ret2) {
         $main->message->set_fromlang('info', 'delete_success', self_ref());
     } else {
         $main->message->set_fromlang('error', 'generic');
     }
 }
Example #9
0
    function output()
    {
        if ($_SERVER['REQUEST_METHOD'] == 'POST' && method_exists($this, 'output_onpost_' . $_POST['form_name'])) {
            return call_user_func(array($this, 'output_onpost_' . $_POST['form_name']));
        }
        global $construct, $db, $vars, $main;
        $main->html->head->add_script("text/javascript", "./templates/basic/scripts/javascripts/fancyzoom/js-global/FancyZoom_packed.js");
        $main->html->head->add_script("text/javascript", "./templates/basic/scripts/javascripts/fancyzoom/js-global/FancyZoomHTML_packed.js");
        $main->html->body->tags['onload'] = "setupZoom();";
        if ($db->cnt('', 'nodes ' . 'INNER JOIN users_nodes ON users_nodes.node_id = nodes.id ' . 'INNER JOIN users ON users_nodes.user_id = users.id', "nodes.id = " . intval(get('node')) . ' AND users.status = "activated"') == 0) {
            $main->message->set_fromlang('error', 'node_not_found');
            return;
        }
        $this->tpl['node'] = $db->get('nodes.id, nodes.name, nodes.date_in, nodes.latitude, nodes.longitude, nodes.elevation, nodes.info, nodes.status, nodes.due_date, areas.name as area_name, regions.name as region_name, users.username AS owner_username, users.email AS owner_email', 'nodes
			LEFT JOIN areas ON nodes.area_id = areas.id
			LEFT JOIN regions ON areas.region_id = regions.id
			LEFT JOIN users_nodes ON users_nodes.node_id = nodes.id
			LEFT JOIN users ON users.id = users_nodes.user_id', "nodes.id = " . intval(get('node')) . " AND (users_nodes.owner = 'Y' OR users_nodes.owner IS NULL)");
        $this->tpl['node'] = $this->tpl['node'][0];
        $this->tpl['link_contact'] = self_ref(array("subpage" => "contact"));
        $this->tpl['table_ip_ranges'] = $construct->table($this->table_ip_ranges(), __FILE__);
        $this->tpl['table_ip_ranges_v6'] = $construct->table($this->table_ip_ranges_v6(), __FILE__);
        $this->tpl['table_dns'] = $construct->table($this->table_dns(), __FILE__);
        $this->tpl['table_nameservers'] = $construct->table($this->table_nameservers(), __FILE__);
        $this->tpl['table_links_p2p'] = $construct->table($this->table_links_p2p(), __FILE__);
        $t = $db->get('id, type', 'links', "node_id = " . intval(get('node')));
        foreach ((array) $t as $key => $value) {
            if ($value['type'] == 'ap') {
                $this->tpl['table_links_ap'][$value['id']] = $construct->table($this->table_links_ap($value['id']), __FILE__);
            }
        }
        $this->tpl['table_links_free'] = $construct->table($this->table_links_free(intval(get('node'))), __FILE__);
        $this->tpl['table_ipaddr_subnets'] = $construct->table($this->table_ipaddr_subnets(), __FILE__);
        $this->tpl['table_services'] = $construct->table($this->table_services(), __FILE__);
        $t = $db->get('id, date_in, view_point, info', 'photos', "node_id = " . intval(get('node')));
        foreach ((array) $t as $key => $value) {
            $this->tpl['photosview'][$value['view_point']] = $value;
            $this->tpl['photosview'][$value['view_point']]['image_s'] = surl($vars['folders']['photos'] . 'photo-' . $this->tpl['photosview'][$value['view_point']]['id'] . '-s.jpg');
            $this->tpl['photosview'][$value['view_point']]['image'] = surl($vars['folders']['photos'] . 'photo-' . $this->tpl['photosview'][$value['view_point']]['id'] . '.jpg');
        }
        $this->tpl['link_plot_link'] = make_ref('/nodes/plot_link', array("a_node" => $this->tpl['node']['id']));
        if (isset($main->userdata->privileges['admin']) && $main->userdata->privileges['admin'] === TRUE || $db->cnt('', "users_nodes", "node_id = " . get('node') . " AND user_id = '" . $main->userdata->user . "'") > 0) {
            $this->tpl['edit_node'] = make_ref('/node_editor', array("node" => get('node')));
        }
        include_map('map');
        return template($this->tpl, __FILE__);
    }
Example #10
0
 function output()
 {
     if ($_SERVER['REQUEST_METHOD'] == 'POST' && method_exists($this, 'output_onpost_' . $_POST['form_name'])) {
         return call_user_func(array($this, 'output_onpost_' . $_POST['form_name']));
     }
     global $construct, $db, $main;
     if (get('action') === "delete") {
         $ret = $db->del("ip_ranges", '', "id = '" . get('iprange') . "'");
         if ($ret) {
             $main->message->set_fromlang('info', 'delete_success', make_ref('/hostmaster/ranges'));
         } else {
             $main->message->set_fromlang('error', 'generic');
         }
         return;
     }
     $this->tpl['form_range'] = $construct->form($this->form_range(), __FILE__);
     $this->tpl['table_node_info'] = $construct->table($this->table_node_info(), __FILE__);
     $this->tpl['table_user_info'] = $construct->table($this->table_user_info(), __FILE__);
     $this->tpl['table_links'] = $construct->table($this->table_links(), __FILE__);
     $this->tpl['table_ip_ranges'] = $construct->table($this->table_ip_ranges(), __FILE__);
     $this->tpl['link_range_delete'] = self_ref(array("action" => "delete"));
     return template($this->tpl, __FILE__);
 }
Example #11
0
 function output_onpost_table_photosview()
 {
     global $vars, $db, $main;
     if (isset($_POST['id'])) {
         foreach ((array) $_POST['id'] as $key => $value) {
             $db->del("photos", '', "id = '" . intval($value) . "' AND node_id = " . intval(get('node')));
             if ($db->affected_rows > 0) {
                 $uploaddir = $vars['folders']['photos'];
                 $filename = 'photo-' . $value . ".*";
                 delfile(ROOT_PATH . $uploaddir . $filename);
                 $filename = 'photo-' . $value . "-*.*";
                 delfile(ROOT_PATH . $uploaddir . $filename);
             }
         }
     }
     foreach ((array) array('N', 'NE', 'E', 'SE', 'S', 'SW', 'W', 'NW', 'PANORAMIC') as $value) {
         if (isset($_FILES[$value]['tmp_name'])) {
             if (!imagecreatefromjpeg($_FILES[$value]['tmp_name'])) {
                 continue;
             }
             $db->add("photos", array('node_id' => intval(get('node')), 'type' => 'view', 'view_point' => $value, 'info' => $_POST['info-' . $value]));
             $ins_id = $db->insert_id;
             $uploaddir = $vars['folders']['photos'];
             $filename = 'photo-' . $ins_id . '.jpg';
             $filename_s = 'photo-' . $ins_id . '-s.jpg';
             if (@move_uploaded_file($_FILES[$value]['tmp_name'], ROOT_PATH . $uploaddir . $filename) === FALSE) {
                 $db->del("photos", '', "id = '" . $ins_id . "'");
                 $main->message->set_fromlang("error", "upload_file_failed");
                 return;
             }
             if ($value == 'PANORAMIC') {
                 $image_s = resizeJPG(ROOT_PATH . $uploaddir . $filename, 600, 200);
             } else {
                 $image_s = resizeJPG(ROOT_PATH . $uploaddir . $filename, 200, 200);
             }
             imagejpeg($image_s, ROOT_PATH . $uploaddir . $filename_s);
         } elseif ($_POST['info-' . $value] != '') {
             $db->set("photos", array('info' => $_POST['info-' . $value]), "node_id = " . intval(get('node')) . " AND view_point = '" . $value . "'");
         }
     }
     $main->message->set_fromlang('info', 'update_success', self_ref());
 }
Example #12
0
 function output_onpost_form_user()
 {
     global $main, $db, $vars, $lang;
     if ($_POST['users__password'] != $_POST['users__password_c']) {
         $main->message->set_fromlang('error', 'password_not_match');
         return;
     }
     if ($_POST['users__password'] == '' && get('user') != 'add') {
         unset($_POST['users__password']);
     } else {
         if ($_POST['users__password'] == '') {
             $main->message->set_fromlang('error', 'password_not_valid');
             return;
         }
         $_POST['users__password'] = md5($_POST['users__password']);
     }
     if (get('user') != 'add') {
         $v_old = $db->get('email', 'users', "id = '" . get('user') . "'");
     }
     $ret = TRUE;
     $form_user = $this->form_user();
     array_splice($form_user->data, 2, 1);
     if (!isset($_POST['users__password'])) {
         array_splice($form_user->data, 1, 1);
     }
     if (get('user') == 'add') {
         $a['status'] = 'pending';
         $a['account_code'] = generate_account_code();
     }
     $ret = $form_user->db_set(isset($a) ? $a : "", "users", "id", get('user'));
     if (get('user') == 'add') {
         $ins_id = $db->insert_id;
     } else {
         $ins_id = get('user');
         $a['account_code'] = generate_account_code();
     }
     if ($ret && $main->userdata->privileges['admin'] === TRUE) {
         $ret = $form_user->db_set_multi(array(), "rights", "user_id", get('user'));
         $ret = $ret && $form_user->db_set_multi(array(), "users_nodes", "user_id", $ins_id);
         $ret = $ret && $db->del('users_nodes', '', "user_id = '" . $ins_id . "' AND owner = 'Y'");
         if (isset($_POST['node_id_owner'])) {
             foreach ((array) $_POST['node_id_owner'] as $value) {
                 $ret = $ret && $db->del('users_nodes', '', "node_id = '" . $value . "' AND owner = 'Y'");
                 $ret = $ret && $db->add('users_nodes', array("user_id" => $ins_id, "node_id" => $value, 'owner' => 'Y'));
             }
         }
     }
     if ($ret && (get('user') == 'add' || $v_old[0]['email'] != $_POST['users__email'])) {
         if (get('user') == 'add') {
             $t = 'user_activation';
         } else {
             $t = 'user_change_email';
         }
         $subject = $lang['email'][$t]['subject'];
         $subject = str_replace('##username##', $_POST['users__username'], $subject);
         $body = $lang['email'][$t]['body'];
         $body = str_replace('##username##', $_POST['users__username'], $body);
         $body = str_replace('##act_link##', $vars['site']['url'] . "?page=users&user="******"&action=activate&account_code=" . $a['account_code'], $body);
         $ret = sendmail($_POST['users__email'], $subject, $body);
         if ($ret && (get('user') != 'add' && $v_old[0]['email'] != $_POST['users__email'])) {
             $ret = $db->set('users', array('status' => 'pending', 'account_code' => $a['account_code']), "id = '" . get('user') . "'");
         }
     }
     if ($ret) {
         $main->message->set_fromlang('info', (get('user') == 'add' ? 'signup' : 'edit') . '_success', self_ref());
     } else {
         $main->message->set_fromlang('error', 'generic');
     }
 }
Example #13
0
 function output()
 {
     global $main, $db, $geocalc, $srtm;
     $main->header->hide = TRUE;
     $main->menu->hide = TRUE;
     $main->footer->hide = TRUE;
     $this->tpl['a_node'] = isset($_POST['a_node']) ? $_POST['a_node'] : get('a_node');
     $this->tpl['nodes_pickup_link'] = make_ref('/pickup/nodes');
     if ($this->tpl['a_node'] != '') {
         $a_node_data = $db->get('id, name, latitude, longitude, elevation', 'nodes', "id = '" . $this->tpl['a_node'] . "'");
         $a_node_data = $a_node_data[0];
         $this->tpl['a_node_output'] = $a_node_data['name'] . ' (#' . $a_node_data['id'] . ')';
     }
     $this->tpl['b_node'] = isset($_POST['b_node']) ? $_POST['b_node'] : get('b_node');
     if ($this->tpl['b_node'] != '') {
         $b_node_data = $db->get('id, name, latitude, longitude, elevation', 'nodes', "id = '" . $this->tpl['b_node'] . "'");
         $b_node_data = $b_node_data[0];
         $this->tpl['b_node_output'] = $b_node_data['name'] . ' (#' . $b_node_data['id'] . ')';
     }
     if ($this->tpl['a_node'] != '' && $this->tpl['b_node'] != '') {
         $this->tpl['a_node_azimuth'] = $geocalc->GCAzimuth($a_node_data['latitude'], $a_node_data['longitude'], $b_node_data['latitude'], $b_node_data['longitude']);
         $this->tpl['b_node_azimuth'] = $geocalc->GCAzimuth($b_node_data['latitude'], $b_node_data['longitude'], $a_node_data['latitude'], $a_node_data['longitude']);
         $this->tpl['a_node_geo_elevation'] = $srtm->get_elevation($a_node_data['latitude'], $a_node_data['longitude']);
         $this->tpl['b_node_geo_elevation'] = $srtm->get_elevation($b_node_data['latitude'], $b_node_data['longitude']);
         $this->tpl['a_node_elevation'] = $a_node_data['elevation'];
         $this->tpl['b_node_elevation'] = $b_node_data['elevation'];
         $a_node_total_elevation = $this->tpl['a_node_geo_elevation'] + $this->tpl['a_node_elevation'];
         $b_node_total_elevation = $this->tpl['b_node_geo_elevation'] + $this->tpl['b_node_elevation'];
         $this->tpl['distance'] = $geocalc->GCDistance($a_node_data['latitude'], $a_node_data['longitude'], $b_node_data['latitude'], $b_node_data['longitude']);
         if ($this->tpl['distance'] != 0) {
             $this->tpl['a_node_tilt'] = rad2deg(atan(($b_node_total_elevation - $a_node_total_elevation) / ($this->tpl['distance'] * 1000)));
             $this->tpl['b_node_tilt'] = rad2deg(atan(($a_node_total_elevation - $b_node_total_elevation) / ($this->tpl['distance'] * 1000)));
         } else {
             // For links between nodes in the same place but with different elevations (e.g. link between rooftop and floor)
             // FIXME: plotlink function of geoimage class does not plot anything in that (admitedly rare) case, but perhaps it should(?)
             $sign = 0;
             $elev = $b_node_total_elevation - $a_node_total_elevation;
             if ($elev != 0) {
                 $sign = $elev > 0 ? 1 : -1;
             }
             $this->tpl['a_node_tilt'] = ($elev != 0 ? $sign : 0) * 90;
             $this->tpl['b_node_tilt'] = -$this->tpl['a_node_tilt'];
         }
         $this->tpl['distance'] = sqrt(pow($this->tpl['distance'] * 1000, 2) + pow(abs($a_node_total_elevation - $b_node_total_elevation), 2)) / 1000;
         $this->tpl['gearth'] = make_ref('/gearth/download', array("node" => get('a_node'), "node2" => get('b_node'), "show_p2p" => "1", "show_aps" => "1", "show_clients" => "1", "show_unlinked" => "1", "show_links_p2p" => "1", "show_links_client" => "1"));
         if (isset($_GET['frequency'])) {
             $this->tpl['frequency'] = (int) $_GET['frequency'];
         } else {
             //Get the AP frequency and use that
             $a_link_data = $db->get('frequency,type', 'links', "node_id = '" . $this->tpl['a_node'] . "' and frequency > 0");
             $b_link_data = $db->get('frequency,type', 'links', "node_id = '" . $this->tpl['b_node'] . "' and frequency > 0");
             $apFreq = $a_link_data[0]['type'] == 'ap' ? $a_link_data[0]['frequency'] : ($b_link_data[0]['type'] == 'ap' ? $b_link_data[0]['frequency'] : '');
             if ($apFreq > 0) {
                 $this->tpl['frequency'] = (int) $apFreq;
             }
         }
         if ($this->tpl['frequency'] <= 0) {
             $this->tpl['frequency'] = 5500;
         }
         $frequency = $this->tpl['frequency'] * 1000000;
         $c = 299792.458;
         // light speed in km
         $this->tpl['fsl'] = 20 * log10(4 * pi() * $this->tpl['distance'] * ($frequency / $c));
         $this->tpl['plot_image'] = make_ref('/nodes/plot', array("a_node" => $this->tpl['a_node'], "b_node" => $this->tpl['b_node'], "frequency" => $this->tpl['frequency']));
     }
     $this->tpl['action_url'] = self_ref();
     return template($this->tpl, __FILE__);
 }
Example #14
0
 function db_data_search($form)
 {
     $sc = unserialize(stripslashes(get($form->info['FORM_NAME'] . '_search')));
     for ($i = 0; $i < count($form->data); $i++) {
         if (isset($form->data[$i])) {
             $sf = isset($sc[$form->data[$i]['fullField']]) ? $sc[$form->data[$i]['fullField']] : '';
             $search[$form->data[$i]['fullField']] = isset($_POST[$form->data[$i]['fullField']]) ? $_POST[$form->data[$i]['fullField']] : $sf;
             if (isset($form->data[$i]['Compare'])) {
                 $sf_cmp = isset($sc[$form->data[$i]['fullField'] . '_compare']) ? $sc[$form->data[$i]['fullField'] . '_compare'] : '';
                 $search[$form->data[$i]['fullField'] . '_compare'] = isset($_POST[$form->data[$i]['fullField'] . '_compare']) ? $_POST[$form->data[$i]['fullField'] . '_compare'] : $sf_cmp;
             }
         }
     }
     $search = serialize($search);
     if (isset($this->info['TOTAL_PAGES'])) {
         for ($i = 1; $i <= $this->info['TOTAL_PAGES']; $i++) {
             $this->info['PAGES'][$i] = self_ref(array($form->info['FORM_NAME'] . "_search" => $search, $this->info['TABLE_NAME'] . "_showpage" => $i));
         }
     }
 }
 function output()
 {
     if ($_SERVER['REQUEST_METHOD'] == 'POST' && method_exists($this, 'output_onpost_' . $_POST['form_name'])) {
         return call_user_func(array($this, 'output_onpost_' . $_POST['form_name']));
     }
     global $construct, $db, $main;
     if (get('action') === "delete") {
         $ret1->db_data('ipv6_node_repos.id AS id', 'ip_ranges_v6, ipv6_node_repos ' . '', "ip_ranges_v6.id = '" . get('v6net_id') . "' and ipv6_node_repos.node_id = ip_ranges_v6.node_id", "", "ASC");
         $ret = $db->del("ip_ranges_v6", '', "id = '" . get('v6net_id') . "'");
         $ret2 = TRUE;
         $ret2 = $ret2 && $db->set("ipv6_node_repos", array('node_id' => '0'), "id = '" . $ret1[0]['v6net_id'] . "'");
         if ($ret && $ret2) {
             $main->message->set_fromlang('info', 'delete_success', make_ref('/hostmaster/ranges_v6'));
         } else {
             $main->message->set_fromlang('error', 'generic');
         }
         return;
     }
     $this->tpl['form_range_v6'] = $construct->form($this->form_range_v6(), __FILE__);
     $this->tpl['table_node_info'] = $construct->table($this->table_node_info(), __FILE__);
     $this->tpl['table_user_info'] = $construct->table($this->table_user_info(), __FILE__);
     $this->tpl['table_links'] = $construct->table($this->table_links(), __FILE__);
     $this->tpl['table_ip_ranges_v6'] = $construct->table($this->table_ip_ranges_v6(), __FILE__);
     $this->tpl['link_range_delete'] = self_ref(array("action" => "delete"));
     return template($this->tpl, __FILE__);
 }
Example #16
0
 function output_onpost_form_change_password()
 {
     global $main, $db;
     if ($db->cnt('', 'users', "account_code IS NOT NULL AND account_code = '" . get('account_code') . "' AND id = '" . get('user') . "'") == 1) {
         if ($_POST['users__password'] == $_POST['users__password_c'] && $_POST['users__password'] != '') {
             $ret = $db->set('users', array("status" => "activated", "account_code" => generate_account_code(), "password" => md5($_POST['users__password'])), "id = '" . get('user') . "'");
             if ($ret) {
                 $main->message->set_fromlang('info', 'password_restored', self_ref());
             } else {
                 $main->message->set_fromlang('error', 'generic');
             }
         } else {
             $main->message->set_fromlang('error', 'password_not_match');
         }
     } else {
         $main->message->set_fromlang('error', 'generic');
     }
 }