Beispiel #1
0
if (!$tab['id']) {
    $tpl['MESSAGE:H'] = $language['AccessPointNotExist'];
    unset($tab);
}
$checked['http_auth'] = $tab['http_auth'] ? " checked='checked'" : "";
$checked['filtering'] = $tab['filtering'] ? " checked='checked'" : "";
$checked['pwd_encrypt'] = $tab['pwd_encrypt'] ? " checked='checked'" : "";
$checked['change_pwd'] = $tab['change_pwd'] ? " checked='checked'" : "";
$checked['registration'] = $tab['registration'] ? " checked='checked'" : "";
$checked['reg_group'] = $tab['registration'] ? true : false;
$form_name = 'ModifyAccesspoints';
$is_console = sumo_verify_is_console($tab['path']) ? true : false;
$path_console = $is_console ? $tab['path'] : sumo_get_rand_string(8);
// bad solution
// Delete
if ($SUMO['user']['group_level']['sumo'] > 4 && (!sumo_verify_is_console($tab['path']) || $tab['id'] != 1)) {
    $msg = sumo_get_simple_rand_string(4, "123456789");
    $delete = "<div class='sub-module-icon' " . "onmouseover='this.style.outline=\"1px solid #999999\";this.style.background=\"#FFFFFF\"' " . "onmouseout='this.style.outline=\"\";this.style.background=\"\"'>" . "<a href=\"javascript:" . "sumo_show_message('msg{$msg}', '" . htmlspecialchars(sumo_get_message('AreYouSureDelete', array($tab['path'], htmlspecialchars(sumo_get_accesspoint_name($tab['name'], $_COOKIE['language']), ENT_QUOTES)))) . "', \n\t\t\t\t\t\t'h', 0, \n\t\t\t\t\t\t'" . base64_encode(sumo_get_form_req('', 'delete', 'id=' . $tab['id'])) . "',\n\t\t\t\t\t\t'" . base64_encode('') . "',\n\t\t\t\t\t\t'" . base64_encode("<input type='button' value='" . $language['Cancel'] . "' onclick='javascript:sumo_remove_window(\"msg{$msg}\");' class='button'>") . "',\n\t\t\t\t\t\t'" . base64_encode("<input type='submit' value='" . $language['Ok'] . "' onclick='javascript:sumo_remove_window(\"msg{$msg}\");' class='button'>") . "'\n\t\t\t\t);\">" . "<img src='themes/" . $SUMO['page']['theme'] . "/images/modules/accesspoints/remove.png' vspace='4'><br>" . $language['Remove'] . "</a>" . "</div>";
} else {
    $delete = sumo_get_action_icon("", "remove");
}
$tpl['GET:ID'] = $tab['id'];
$tpl['GET:RegGroup'] = $tab['reg_group'];
$tpl['GET:Updated'] = sumo_get_human_date($tab['updated']);
$tpl['GET:Created'] = sumo_get_human_date($tab['created']);
$tpl['GET:UpdateForm'] = sumo_get_form_req('', 'modify', 'id=' . $tab['id']);
$tpl['GET:Created'] = sumo_get_human_date($tab['created']);
$tpl['PUT:Node'] = $tab['id'] > 1 ? sumo_put_node($tab['node']) : sumo_put_node($tab['node'], true);
$tpl['PUT:Groups'] = sumo_put_accesspoint_group($tab['id']);
$tpl['PUT:AddGroup'] = sumo_add_accesspoint_group(sumo_get_grouplevel($tab['usergroup'], true));
$tpl['PUT:AddRegGroup'] = sumo_add_accesspoint_group($tab['reg_group'], 'reg_group', $checked['reg_group']);
Beispiel #2
0
<?php

/**
 * SUMO MODULE: Accesspoints | Delete
 * 
 * @version    0.4.0
 * @link       http://sumoam.sourceforge.net SUMO Access Manager
 * @author     Alberto Basso <*****@*****.**>
 * @copyright  Copyright &copy; 2003-2009, Alberto Basso
 * @package    SUMO
 * @category   Console
 */
$tab = sumo_get_accesspoint_info($_GET['id'], 'id');
if (!sumo_verify_is_console($tab['path']) || $tab['id'] != 1) {
    $delete = sumo_delete_accesspoint($_GET['id']);
    if ($delete) {
        $tpl['MESSAGE:L'] = $language['AccessPointDeleted'];
    } else {
        $tpl['MESSAGE:H'] = $language['AccessPointNotDeleted'];
    }
} else {
    $tpl['MESSAGE:H'] = $language['CannotDeleteThis'];
}
require "action.list.php";
Beispiel #3
0
<?php

/**
 * SUMO MODULE: Accesspoints | Delete group from AP
 * 
 * @version    0.4.0
 * @link       http://sumoam.sourceforge.net SUMO Access Manager
 * @author     Alberto Basso <*****@*****.**>
 * @copyright  Copyright &copy; 2003-2009, Alberto Basso
 * @package    SUMO
 * @category   Console
 */
$tab = sumo_get_accesspoint_info($_GET['id'], 'id', FALSE);
if (sumo_verify_is_console($tab['path']) && $_GET['group'] == 'sumo') {
    $tpl['MESSAGE:M'] = $language['CannotDeleteGroup'];
} else {
    $update = sumo_update_accesspoint_group($_GET['id'], $_GET['group']);
    if ($update) {
        $tpl['MESSAGE:L'] = $language['AccessPointGroupRemoved'];
    } else {
        $tpl['MESSAGE:H'] = $language['AccessPointGroupNotRemoved'];
    }
}
require "action.edit.php";
Beispiel #4
0
/**
 * Migrate session_id Cookie to all actives nodes 
 *
 * @param boolean $login
 */
function sumo_create_session_id($login = true)
{
    global $SUMO;
    // Get id of the user session
    $session = sumo_get_session_info();
    $query = "SELECT host,port,name,protocol,sumo_path FROM " . SUMO_TABLE_NODES . " \n\t\t    WHERE active = 1\n\t\t\tAND host <> 'localhost'\n\t\t\tAND host <> '" . $SUMO['server']['ip'] . "' \n\t\t\tAND host <> '" . $SUMO['server']['name'] . "'";
    $rs = $SUMO['DB']->CacheExecute(30, $query);
    while ($tab = $rs->FetchRow()) {
        $url = $tab['protocol'] . '://' . $tab['host'] . ':' . $tab['port'] . $tab['sumo_path'] . '/services.php?module=network&service=network&cmd=CREATE_SID' . '&id=' . $session['id'];
        // Modify hostname for HTTPS
        $hostname = $tab['protocol'] == 'https' ? 'ssl://' . $tab['host'] : $tab['host'];
        // try connection before redirect
        $connect = @fsockopen($hostname, $tab['port'], $errno, $errstr, 4);
        if ($connect) {
            if ($login || !sumo_verify_is_console($SUMO['page']['path'])) {
                echo "<iframe src='{$url}' style='visibility:hidden;width:0px;height:0px;display:none'></iframe>";
            } else {
                echo "<script>parent.CSID.location.href='{$url}';</script>";
            }
        } else {
            sumo_write_log('E00123X', array($tab['host'], "RC " . $errno . ": " . $errstr), '0,1', 1, 'system', FALSE);
        }
    }
}
Beispiel #5
0
/**
 * Update accesspoint data
 */
function sumo_update_accesspoint_data($data = array())
{
    if (!empty($data)) {
        global $SUMO;
        $id = intval($data['id']);
        $node = $data['node'] ? intval($data['node']) : "NULL";
        $path = $data['path'];
        $group = $data['group'];
        $reg_group = $data['reg_group'];
        $theme = $data['theme'];
        $http_auth = $data['http_auth'] == 'on' || $data['http_auth'] == 1 ? 1 : 0;
        $filtering = $data['filtering'] == 'on' || $data['filtering'] == 1 ? 1 : 0;
        $pwd_encrypt = $data['pwd_encrypt'] == 'on' || $data['pwd_encrypt'] == 1 ? 1 : 0;
        $change_pwd = $data['change_pwd'] == 'on' || $data['change_pwd'] == 1 ? 1 : 0;
        $registration = $data['registration'] == 'on' || $data['registration'] == 1 ? 1 : 0;
        // AP names
        $languages = sumo_get_available_languages();
        $names = "";
        for ($l = 0; $l < count($languages); $l++) {
            $names[$l] = $languages[$l] . ":" . $data['name'][$languages[$l]];
        }
        $name = implode(";", $names);
        $filtering = sumo_verify_is_console($path) ? 1 : $filtering;
        /**
         * Kill all sessions at path where pwd_encrypt 
         * or http_auth it has been changed
         */
        $accesspoint = sumo_get_accesspoint_info($id, 'id', FALSE);
        $nodeinfo = sumo_get_node_info($node);
        if ($accesspoint['pwd_encrypt'] != $pwd_encrypt || $accesspoint['http_auth'] != $http_auth) {
            $query = "DELETE FROM " . SUMO_TABLE_SESSIONS . " \r\n\t\t\t\t\t  WHERE node='" . $nodeinfo['ip'] . "' AND url LIKE '%" . $path . "'";
            $SUMO['DB']->Execute($query);
        }
        // Delete cached data
        #if($path) $SUMO['DB']->CacheFlush("SELECT * FROM ".SUMO_TABLE_ACCESSPOINTS."
        #								   WHERE path='".$path."'");
        if ($node >= 1) {
            $record['node'] = "node=" . $node;
        }
        if ($path) {
            $record['path'] = "path='" . $path . "'";
        }
        if ($name) {
            $record['name'] = "name='" . $name . "'";
        }
        if ($group) {
            $record['group'] = "usergroup='" . sumo_get_ordered_groups($group) . "'";
        }
        if ($reg_group) {
            $record['reg_group'] = "reg_group='" . $reg_group . "'";
        }
        if ($theme) {
            $record['theme'] = "theme='" . $theme . "'";
        }
        $record['http_auth'] = "http_auth=" . $http_auth;
        $record['filtering'] = "filtering=" . $filtering;
        $record['pwd_encrypt'] = "pwd_encrypt=" . $pwd_encrypt;
        $record['change_pwd'] = "change_pwd=" . $change_pwd;
        $record['registration'] = "registration=" . $registration;
        $record['updated'] = "updated=" . $SUMO['server']['time'];
        // Create fields for query
        $new_record = array_values($record);
        for ($r = 0; $r < count($new_record); $r++) {
            if ($new_record[$r]) {
                $records[$r] = $new_record[$r];
            }
        }
        $update = implode(', ', $records);
        $select = implode(' AND ', $records);
        // create query
        $query = "UPDATE " . SUMO_TABLE_ACCESSPOINTS . " \r\n\t\t\t\t  SET " . $update . " \r\n\t\t\t\t  WHERE id=" . $id;
        $SUMO['DB']->CacheFlush();
        $SUMO['DB']->Execute($query);
        // verify query success
        $query = "SELECT COUNT(id) FROM " . SUMO_TABLE_ACCESSPOINTS . " \r\n\t\t\t\t  WHERE id=" . $id . " \r\n\t\t\t\t  AND " . $select;
        $rs = $SUMO['DB']->Execute($query);
        $tab = $rs->FetchRow();
        // if updated:
        if ($tab[0] == 1) {
            if ($nodeinfo['ip'] == '') {
                $nodeinfo['ip'] = 'UNDEFINED';
            }
            $apname = sumo_get_accesspoint_name($name, $SUMO['config']['server']['language']);
            sumo_write_log('I07000X', array($id, $apname, $nodeinfo['ip'], $SUMO['user']['user']), 3, 3, 'system', FALSE);
            return TRUE;
        } else {
            return FALSE;
        }
    }
}
Beispiel #6
0
     $path3 = sumo_get_accesspoint_name($tab['name'], $_COOKIE['language']);
     $node = $tab['node_name'];
 }
 $http_auth = $tab['http_auth'] ? 'httpauth' : 'nohttpauth';
 $filtering = $tab['filtering'] ? 'filtering' : 'nofiltering';
 $pwd_encrypt = $tab['pwd_encrypt'] ? 'encrypt' : 'noencrypt';
 $registration = $tab['registration'] ? 'reg' : 'noreg';
 $change_pwd = $tab['change_pwd'] ? 'changepwd' : 'nochangepwd';
 $group = str_replace(';', ', ', $tab['usergroup']);
 $group = strlen($group) > 50 ? substr($group, 0, 50) . '...' : $group;
 $theme = ucwords($tab['theme']);
 $created = $tab['created'] ? sumo_get_human_date($tab['created']) : '';
 $updated = $tab['updated'] ? sumo_get_human_date($tab['updated']) : '';
 $style = sumo_alternate_str('tab-row-on', 'tab-row-off');
 $style2 = $tab['updated'] > $SUMO['server']['time'] - 10 ? " style='border-top:1px solid #FF7722;border-bottom:1px solid #FF7722'" : "";
 if (sumo_verify_is_console($tab['path'])) {
     $path3 = '<b>' . $path3 . '</b>';
 }
 $list .= "<tr{$style2}>\n";
 if ($col[4]) {
     $list .= " <td class='" . $style . "'><a href='javascript:sumo_ajax_get(\"accesspoints.content\",\"?module=accesspoints&decoration=false&action=view&id=" . $tab['id'] . "\");'>" . $path3 . "</a></td>\n";
 }
 if ($col[2]) {
     $list .= " <td class='" . $style . "'><a href='javascript:sumo_ajax_get(\"network\",\"?module=network&action=view_node&id=" . $tab['node_id'] . "\");'>" . $node . "</a></td>\n";
 }
 if ($col[3]) {
     $list .= " <td class='" . $style . "'><a href='" . $tab['path'] . "' target='_blank'>" . $path2 . "</a></td>\n";
 }
 if ($col[5]) {
     $list .= " <td class='" . $style . "' width='100%'>" . $group . "</td>\n";
 }