Example #1
0
<?php

/**
 * SUMO MODULE: Accesspoints | New
 * 
 * @version    0.5.0
 * @link       http://sumoam.sourceforge.net SUMO Access Manager
 * @author     Alberto Basso <*****@*****.**>
 * @copyright  Copyright &copy; 2003-2009, Alberto Basso
 * @package    SUMO
 * @category   Console
 */
$id = isset($_GET['id']) ? $_GET['id'] : '';
$tab = sumo_get_accesspoint_info($id, 'id', FALSE);
$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'" : "";
$form_name = 'AddAccesspoints';
$tpl['GET:ID'] = $tab['id'];
$tpl['GET:AddForm'] = sumo_get_form_req('', 'add', 'id=' . $tab['id']);
$tpl['PUT:Node'] = sumo_put_node($tab['node']);
$tpl['PUT:Theme'] = sumo_put_themes($tab['theme']);
$tpl['PUT:Groups'] = sumo_put_accesspoint_group($tab['id']);
$tpl['PUT:AddGroup'] = sumo_add_accesspoint_group();
$tpl['PUT:AddRegGroup'] = sumo_add_accesspoint_group('', 'reg_group');
$tpl['PUT:Name'] = sumo_put_accesspoint_name($form_name, sumo_get_accesspoint_name($tab['name']));
$tpl['PUT:Path'] = "<input type='text' size='35' name='path' value='" . $tab['path'] . "' />";
$tpl['PUT:HTTPAuth'] = "<input type='checkbox' name='http_auth' " . $checked['http_auth'] . " onclick='if(document.{$form_name}.http_auth.checked==true && document.{$form_name}.pwd_encrypt.disabled==false){document.{$form_name}.pwd_encrypt.checked=false;}' />";
$tpl['PUT:Filtering'] = "<input type='checkbox' name='filtering' " . $checked['filtering'] . "  />";
Example #2
0
<?php

/**
 * SUMO MODULE: Accesspoints | Edit
 * 
 * @version    0.5.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 id not exist
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");
Example #3
0
 if ($tab['expire'] < $SUMO['server']['time'] + 500) {
     $color = 'orange';
 }
 if ($tab['expire'] < $SUMO['server']['time'] + 300) {
     $color = 'red';
 }
 $country = explode('-', $tab['country_name']);
 $country[0] = ucwords(strtolower($country[0]));
 $country[1] = strtolower($country[1]);
 $flag = trim($country[1]) ? trim($country[1]) . ".png" : "blank.png";
 if (!$country[1]) {
     $country[1] = 'blank';
 }
 $user = $search ? sumo_color_match_string($field['user'][1], $tab['username']) : $tab['username'];
 $username = sumo_get_username($tab['username']);
 $apinfo = sumo_get_accesspoint_info(sumo_get_normalized_accesspoint($tab['url']), 'path');
 $apname = sumo_get_accesspoint_name($apinfo['name'], $_COOKIE['language']);
 $list .= "<tr>\n";
 if ($col[1]) {
     $list .= " <td class='" . $style . "'><img src='themes/" . $SUMO['page']['theme'] . "/images/modules/sessions/status_" . $color . ".gif' class='session-status'>&nbsp;&nbsp;" . $tab['id'] . "</td>\n";
 }
 if ($col[4]) {
     $list .= " <td class='" . $style . "'><a href='javascript:sumo_ajax_get(\"users\",\"?module=users&action=view&id=" . $tab['id_user'] . "\");" . "' title='" . $language['ViewUser'] . ": " . $username . "'>" . $user . "</a></td>\n";
 }
 if ($col[2]) {
     $list .= " <td class='" . $style . "' align='right'><a href='javascript:sumo_ajax_get(\"network\",\"?module=network&action=view_node&id=" . $node[$tab['node']]['id'] . "\");'>" . $node[$tab['node']]['name'] . "</a></td>\n";
 }
 //if($col[2])  $list .= " <td class='".$style."'><a href='javascript:sumo_ajax_get(\"network\",\"?module=network&action=nlist\");'>".$node[$tab['node']]['name']."</a></td>\n";
 if ($col[7]) {
     $list .= " <td class='" . $style . "' align='right'>" . $tab['ip'] . "</td>\n";
 }
Example #4
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";
Example #5
0
if (SUMO_SESSIONS_DATABASE) {
    require SUMO_PATH . '/applications/adodb/session/adodb-cryptsession2.php';
    require SUMO_PATH . '/inc/inc.db_sessions.php';
} else {
    // preserve session data on shared hosting  ;)
    session_save_path(SUMO_PATH . "/tmp/sessions/");
}
//Overwrite session timeout written in php.ini file
ini_set('session.gc_maxlifetime', $SUMO['config']['sessions']['timeout']);
ini_set('session.gc_probability', 1);
ini_set('session.gc_divisor', 1);
session_name("SUMO");
session_start();
$SUMO['client'] = sumo_get_client_info();
$SUMO['server'] = sumo_get_server_info();
$SUMO['page'] = sumo_get_accesspoint_info();
$sumo_db = NULL;
// ON-LINE DEMO
//$SUMO['DB']->Execute("UPDATE ".SUMO_TABLE_USERS." SET password='******' WHERE username='******'");
// Save original input data from page
if (!$SUMO['page']['filtering']) {
    $_OLD_GET = $_GET;
    $_OLD_POST = $_POST;
    $_OLD_COOKIE = $_COOKIE;
}
if (!sumo_verify_is_today()) {
    sumo_update_day_limit();
    sumo_write_today();
    sumo_delete_old_users_temp();
    sumo_delete_old_sessions();
    sumo_delete_old_connections();
Example #6
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;
        }
    }
}