/** * Update accesspoint group * * @author Alberto Basso */ function sumo_update_accesspoint_group($id = 0, $group = FALSE) { $id = intval($id); if ($id > 0 && sumo_validate_group($group, FALSE) && sumo_verify_permissions(5, $group)) { global $SUMO; $query1 = "SELECT usergroup FROM " . SUMO_TABLE_ACCESSPOINTS . " \r\n\t\t\t\t WHERE id=" . $id; $rs = $SUMO['DB']->Execute($query1); $tab = $rs->FetchRow(); $new_group = sumo_get_normalized_group(str_replace($group, '', $tab[0]), TRUE); $query2 = "UPDATE " . SUMO_TABLE_ACCESSPOINTS . " \r\n\t\t\t\t SET usergroup='" . $new_group . "' \r\n\t\t\t\t WHERE id=" . $id; $SUMO['DB']->CacheFlush(); $SUMO['DB']->Execute($query1); $SUMO['DB']->Execute($query2); sumo_write_log('I07001X', array($id, $group, $new_group, $SUMO['user']['user']), '0,1', 3, 'system', FALSE); return TRUE; } else { return FALSE; } }
$delete = sumo_get_action_icon("", "remove"); } $node = sumo_get_node_info($tab['node']); $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:Created'] = sumo_get_human_date($tab['created']); $tpl['GET:Node'] = $node['name']; $tpl['GET:Groups'] = implode(", ", $tab['usergroup']); $tpl['GET:RegGroup'] = $tab['reg_group']; $tpl['GET:Theme'] = ucfirst($tab['theme']); $tpl['GET:Name'] = sumo_get_accesspoint_name($tab['name'], $_COOKIE['language']); $tpl['GET:Filtering'] = "<input type='checkbox' name='filtering' " . $checked['filtering'] . " disabled />"; $tpl['GET:ChangePwd'] = "<input type='checkbox' name='change_pwd' " . $checked['change_pwd'] . " disabled />"; $tpl['GET:Registration'] = "<input type='checkbox' name='registration' " . $checked['registration'] . " disabled />"; $tpl['GET:Path'] = "<input type='text' size='50' name='path' value='" . $tab['path'] . "' disabled />"; $tpl['GET:HTTPAuth'] = "<input type='checkbox' name='http_auth' " . $checked['http_auth'] . " disabled />"; $tpl['GET:PwdEncrypt'] = "<input type='checkbox' name='pwd_encrypt' " . $checked['pwd_encrypt'] . " disabled />"; $tpl['LINK:Add'] = sumo_verify_permissions(5, 'sumo') ? sumo_get_action_icon("", "add", "accesspoints.content", "?module=accesspoints&action=new&decoration=false") : sumo_get_action_icon("", "add"); $tpl['LINK:Edit'] = sumo_verify_permissions(4, 'sumo') ? sumo_get_action_icon("", "edit", "accesspoints.content", "?module=accesspoints&action=edit&id=" . $tab['id'] . "&decoration=false") : sumo_get_action_icon("", "edit"); $tpl['LINK:Remove'] = $delete; $tpl['BUTTON:Back'] = "<input type='button' class='button-red' value='" . $language["Back"] . "' onclick='javascript:sumo_ajax_get(\"accesspoints\",\"?module=accesspoints&action=list\");'>"; // Use REQUEST method because when delete a group on AP // the command came from a link $visibility['SecurityOptions'] = $_REQUEST['SecurityOptions_visibility'] ? true : false; $visibility['LayoutOptions'] = $_REQUEST['LayoutOptions_visibility'] ? true : false; $tpl['LINK:SecurityOptions'] = sumo_get_action_link($form_name, 'SecurityOptions', $visibility['SecurityOptions']); $tpl['LINK:LayoutOptions'] = sumo_get_action_link($form_name, 'LayoutOptions', $visibility['LayoutOptions']); // delete old refresh window and update $tpl['GET:WindowScripts'] .= 'sumo_unrefresh_window("accesspoints");';
<?php /** * SUMO MODULE: Network | View Node * * @version 0.5.0 * @link http://sumoam.sourceforge.net SUMO Access Manager * @author Alberto Basso <*****@*****.**> * @copyright Copyright © 2003-2009, Alberto Basso * @package SUMO * @category Console */ $tab = sumo_get_node_info($_GET['id'], 'id', FALSE); $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('AreYouSureDeleteNode', $tab['name'])) . "', \n\t\t\t\t\t\t\t 'h', 0, \n\t\t\t\t\t\t\t '" . base64_encode(sumo_get_form_req('', 'erase_node', 'id=' . $tab['id'])) . "',\n\t\t\t\t\t\t\t '" . base64_encode('') . "',\n\t\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\t '" . base64_encode("<input type='submit' value='" . $language['Ok'] . "' onclick='javascript:sumo_remove_window(\"msg{$msg}\");' class='button'>") . "'\n\t\t\t\t\t\t\t);\">" . "<img src='themes/" . $SUMO['page']['theme'] . "/images/modules/network/remove_node.png' vspace='4'><br>" . $language['Remove'] . "</a>" . "</div>"; $tpl = array('MESSAGE:H' => $tpl['MESSAGE:H'], 'MESSAGE:M' => $tpl['MESSAGE:M'], 'MESSAGE:L' => $tpl['MESSAGE:L'], 'GET:Theme' => $SUMO['page']['theme'], 'GET:MenuModule' => $tpl['GET:MenuModule'], 'GET:Status' => $tab['active'] ? "<font class='status-green'>" . $language['Active'] . "</font>" : "<font class='status-red'>" . $language['Disabled'] . "</font>", 'GET:NodeName' => $tab['name'], 'GET:Host' => $tab['host'], 'GET:Port' => $tab['port'], 'GET:Protocol' => $tab['protocol'], 'GET:SumoPath' => $tab['sumo_path'], 'LINK:Add' => sumo_verify_permissions(4, 'sumo') ? sumo_get_action_icon("network", "add_node", "network.content", "?module=network&action=new_node&decoration=false") : sumo_get_action_icon("", "add_node"), 'LINK:Edit' => sumo_verify_permissions(4, 'sumo') && $tab['id'] > 1 ? sumo_get_action_icon("network", "edit_node", "network.content", "?module=network&action=edit_node&id=" . $tab['id'] . "&decoration=false") : sumo_get_action_icon("", "edit_node"), 'LINK:Remove' => sumo_verify_permissions(4, 'sumo') && $tab['id'] > 1 ? $delete : sumo_get_action_icon("", "remove_node"), 'BUTTON:Back' => "<input type='button' class='button-red' value='" . $language["Back"] . "' onclick='javascript:sumo_ajax_get(\"network.content\",\"?module=network&action=nlist&decoration=false\");'>");
<?php /** * SUMO MODULE: Security | Banned * * @version 0.5.0 * @link http://sumoam.sourceforge.net SUMO Access Manager * @author Alberto Basso <*****@*****.**> * @copyright Copyright © 2003-2009, Alberto Basso * @package SUMO * @category Console */ // ...verify if user can enable banned ip's $enableip = sumo_verify_permissions(4, 'sumo'); // enable IP address if ($_GET['enableip'] != '' && $enableip) { sumo_enable_bannedip($_GET['enableip']); } // set table settings sumo_set_table_settings(); // Create search query $search = ''; if ($_SESSION['search_security_banned']) { $field['ip'] = sumo_search_composer($_SESSION['search_security_banned'], 'ip'); $search = $field['ip'][0] ? " WHERE " . $field['ip'][0] . " " : ''; } $query1 = "SELECT * FROM " . SUMO_TABLE_BANNED . " " . $search . " "; $query2 = $query1 . " ORDER BY " . $_SESSION['security']['banned']['col_sql'] . " " . $_SESSION['security']['banned']['mode_sql']; $rs = $SUMO['DB']->Execute($query1); $tot = $rs->PO_RecordCount(); $rs = $SUMO['DB']->SelectLimit($query2, $_SESSION['rows_security_banned'], $_SESSION['start_security_banned']);
<?php /** * SUMO MODULE: Users | Delete User Image * * @version 0.3.4 * @link http://sumoam.sourceforge.net SUMO Access Manager * @author Alberto Basso <*****@*****.**> * @copyright Copyright © 2003-2009, Alberto Basso * @package SUMO * @category Console */ $tab = sumo_get_user_info($_GET['id'], 'id', FALSE); if (sumo_verify_permissions(4, $tab['group'])) { if ($SUMO['user']['id'] == $_GET['id'] || $SUMO['user']['user'] == 'sumo') { $validate[0] = ''; // If id not exist if (!$tab['id']) { $tpl['MESSAGE:H'] = sumo_get_message('W00001C', $_GET['id']); } else { sumo_delete_user_image($_GET['id']); } if ($validate[0]) { $tpl['MESSAGE:M'] = $validate[1]; } $tpl['GET:UpdateForm'] = "<form action='?module=users&action=editimg&id=" . $tab['id'] . "' " . "name='UpdateUserImg' method='POST' enctype='multipart/form-data'>"; $tpl['IMG:User'] = "******" . $tab['id'] . "' alt='" . $tab['username'] . "' class='user'>"; $tpl['PUT:UserImage'] = "<input type='hidden' name='MAX_FILE_SIZE' value='30720'>" . "<input type='file' size='20' class='file' name='user_image' >"; $tpl['GET:DeleteForm'] = "<form action='?module=users&action=deleteimg&id=" . $tab['id'] . "' name='DeleteUserImg' method='POST'>\n" . "<input type='submit' class='button' value='" . $language['Delete'] . "'>\n" . "</form>"; // Note: not using sumo_show_window() function // because for this event a window is external
} } // Initialize windows $tpl['GET:ModulesWindows'] .= "<!-- -->\n\n<script type='text/javascript'>\n<!--\n\tSET_DHTML(\n"; for ($m = 0; $m < $num_modules; $m++) { $m_name = $modules[$m]; // Verify permissions if (sumo_verify_permissions($_level[$m_name], $_group[$m_name], $_user[$m_name])) { $tpl['GET:ModulesWindows'] .= "\t\t'" . $m_name . "'" . "+MAXOFFTOP+" . ($yw[$m_name] - 18) . "+MAXOFFLEFT+" . $xw[$m_name] . "+SCROLL"; if ($m < $num_modules - 1) { $tpl['GET:ModulesWindows'] .= ",\n"; } } } $tpl['GET:ModulesWindows'] .= "\n\t);\n" . "-->\n</script>\n"; //---------------- // Reload last window opened for ($m = 0; $m < $num_modules; $m++) { if ($desktop['settings'][$modules[$m]]['s']) { $m_name = $modules[$m]; // Verify permissions if (sumo_verify_permissions($_level[$m_name], $_group[$m_name], $_user[$m_name])) { $tpl['GET:ModulesWindows'] .= sumo_get_module_start($m_name, $desktop['settings'][$m_name]['action']); } } } //---------------- // Splashscreen $tpl['GET:Splashscreen'] = sumo_get_splashscreen(); // Display Desktop echo sumo_process_template($desktop['template'], $tpl);
if ($col[100]) { $list .= " <td '" . $style2 . "'>" . $status . "</td>\n"; } if ($col[2]) { $list .= " <td class='" . $style . "'><img src='themes/" . $SUMO['page']['theme'] . "/images/modules/network/" . $active . ".gif'></td>\n"; } if ($col[5]) { $list .= " <td class='" . $style . "'>" . "<a href='javascript:sumo_ajax_get(\"network.content\",\"?module=network&action=view_node&id=" . $tab['id'] . "&decoration=false\");'>" . $tab['name'] . "</a></td>\n"; } if ($col[3]) { $list .= " <td class='" . $style . "' align='right'>" . $tab['host'] . "</td>\n"; } if ($col[4]) { $list .= " <td class='" . $style . "' align='right'>" . $tab['port'] . "</td>\n"; } if ($col[6]) { $list .= " <td class='" . $style . "'>" . $tab['protocol'] . "</td>\n"; } if ($col[7]) { $list .= " <td class='" . $style . "'>" . $tab['sumo_path'] . "</td>\n"; } if ($col[8]) { $list .= " <td class='" . $style . "' align='right'>" . $ap . "</td>\n"; } $list .= "</tr>\n"; } $list .= "</table>"; $searched = $search ? $_SESSION['search_network_nlist'] : ''; // Template Data $tpl = array('MESSAGE:H' => $tpl['MESSAGE:H'], 'MESSAGE:M' => $tpl['MESSAGE:M'], 'MESSAGE:L' => $tpl['MESSAGE:L'], 'GET:Theme' => $SUMO['page']['theme'], 'GET:MenuModule' => $tpl['GET:MenuModule'], 'GET:NodesList' => $list, 'GET:TotalRows' => number_format($tot, 0, "", "."), 'GET:StartRow' => number_format($_SESSION['start_network_nlist'], 0, "", "."), 'GET:EndRow' => number_format($_SESSION['start_network_nlist'] + $vis, 0, "", "."), 'GET:PagingResults' => sumo_paging_results($tot, $vis, $_SESSION['rows_network_nlist'], 5, $_SESSION['start_network_nlist'], 'start_network_nlist'), 'GET:TableSettings' => sumo_get_table_settings($table['data']['nlist']), 'GET:SearchForm' => sumo_get_form_search($searched), 'GET:ExportData' => '', 'LINK:AddNode' => sumo_verify_permissions(4, 'sumo') ? sumo_get_action_icon("network", "add_node", "network.content", "?module=network&action=new_node&decoration=false") : sumo_get_action_icon("", "add_node"), 'BUTTON:TestConnection' => "<input value='" . $language['TestConnection'] . "' type='button' class='button' onclick='javascript:sumo_ajax_get(\"network.content\",\"?module=network&action=nlist&test=1&network_nlist_view_col=100.1&decoration=false" . "\");'>"); $tpl['GET:Pagination'] = $tot > 0 ? $tpl['GET:StartRow'] . "..." . $tpl['GET:EndRow'] . " " . $language['of'] . " <b>" . $tpl['GET:TotalRows'] . "</b>" : "";
<?php /** * SUMO MODULE: Network | View Datasource * * @version 0.5.0 * @link http://sumoam.sourceforge.net SUMO Access Manager * @author Alberto Basso <*****@*****.**> * @copyright Copyright © 2003-2009, Alberto Basso * @package SUMO * @category Console */ $tab = sumo_get_datasource_info($_GET['id'], FALSE); $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('AreYouSureDeleteDataSource', $tab['name'])) . "', \n\t\t\t\t\t\t\t 'h', 0, \n\t\t\t\t\t\t\t '" . base64_encode(sumo_get_form_req('', 'erase_datasource', 'id=' . $tab['id'])) . "',\n\t\t\t\t\t\t\t '" . base64_encode('') . "',\n\t\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\t '" . base64_encode("<input type='submit' value='" . $language['Ok'] . "' onclick='javascript:sumo_remove_window(\"msg{$msg}\");' class='button'>") . "'\n\t\t\t\t\t\t\t);\">" . "<img src='themes/" . $SUMO['page']['theme'] . "/images/modules/network/remove_datasource.png' vspace='4'><br>" . $language['Remove'] . "</a>" . "</div>"; $tpl = array('GET:Theme' => $SUMO['page']['theme'], 'GET:MenuModule' => $tpl['GET:MenuModule'], 'GET:DataSourceName' => $tab['name'], 'GET:DataSourceType' => $language[$tab['type']], 'GET:DataSourceHost' => $tab['host'], 'GET:DataSourcePort' => $tab['port'], 'GET:DataSourceUser' => $tab['username'], 'GET:DataSourcePassword' => $tab['password'] != '' ? '*****' : '', 'GET:DBName' => $tab['db_name'], 'GET:DBTable' => $tab['db_table'], 'GET:DBFieldUser' => $tab['db_field_user'], 'GET:DBFieldPassword' => $tab['db_field_password'], 'GET:EncType' => $tab['enctype'], 'GET:LDAPBase' => $tab['ldap_base'], 'LINK:Add' => sumo_verify_permissions(4, 'sumo') ? sumo_get_action_icon("network", "add_datasource", "network.content", "?module=network&action=new_datasource&decoration=false") : sumo_get_action_icon("", "add_datasource"), 'LINK:Edit' => sumo_verify_permissions(4, 'sumo') && $tab['id'] > 1 ? sumo_get_action_icon("network", "edit_datasource", "network.content", "?module=network&action=edit_datasource&id=" . $tab['id'] . "&decoration=false") : sumo_get_action_icon("", "edit_datasource"), 'LINK:Remove' => sumo_verify_permissions(4, 'sumo') && $tab['id'] > 1 ? $delete : sumo_get_action_icon("", "remove_datasource"), 'BUTTON:Back' => "<input type='button' class='button-red' value='" . $language["Back"] . "' onclick='javascript:sumo_ajax_get(\"network.content\",\"?module=network&action=dlist&decoration=false\");'>");
<?php /** * SUMO MODULE: Users | View * * @version 0.5.0 * @link http://sumoam.sourceforge.net SUMO Access Manager * @author Alberto Basso <*****@*****.**> * @copyright Copyright © 2003-2009, Alberto Basso * @package SUMO * @category Console */ $tab = sumo_get_user_info($_GET['id'], 'id', false); if (sumo_verify_permissions(4, $tab['group'], null, false) || sumo_verify_permissions(false, false, $tab['username'], false) || $SUMO['user']['id'] == $tab['owner_id']) { // Create group string to validate group for ($g = 0; $g < count($_POST['group_name']); $g++) { $group[$g] = $_POST['group_name'][$g] . ":" . $_POST['group_level'][$g]; } $_POST['group'] = sumo_get_normalized_group(implode(";", $group)); // If new group exist add it if ($_POST['newgroup']) { $_POST['group'] = sumo_get_normalized_group($_POST['newgroup'] . ";" . $_POST['group']); } // password (SUMO, Joomla) switch ($tab['datasource_type']) { case 'MySQLUsers': case 'Joomla15': $pwd_verify = 'new_password2'; break; default: $pwd_verify = 'new_password';
/** * Update user group */ function sumo_update_user_group($id = 0, $group = FALSE) { $group_level = explode(":", $group); $id = intval($id); if ($id > 0 && sumo_validate_group($group) && sumo_verify_permissions($group_level[1], $group_level[0])) { global $SUMO; $query1 = "SELECT usergroup FROM " . SUMO_TABLE_USERS . "\n\t\t\t\t WHERE id=" . $id; $rs = $SUMO['DB']->Execute($query1); $tab = $rs->FetchRow(); $new_group = sumo_get_normalized_group(str_replace($group, '', $tab[0])); $query2 = "UPDATE " . SUMO_TABLE_USERS . "\n\t\t\t\t SET usergroup='" . $new_group . "',\n\t\t\t\t \t\tmodified=" . $SUMO['server']['time'] . "\n\t\t\t\t WHERE id=" . $id; $SUMO['DB']->CacheFlush("SELECT * FROM " . SUMO_TABLE_USERS . "\n\t\t\t\t\t\t \t\t WHERE id=" . $id); $SUMO['DB']->Execute($query1); $SUMO['DB']->Execute($query2); sumo_write_log('I01002X', array($group, $id, $SUMO['user']['user']), '0,1', 3, 'system', FALSE); return TRUE; } else { return FALSE; } }
$tpl['GET:Form'] = sumo_get_form_req('', 'modify_datasource', 'id=' . $tab['id']); $tpl['PUT:DataSourceType'] = sumo_put_datasources_type($type, $form_name); $tpl['PUT:EncType'] = sumo_put_datasources_enctype($tab['enctype'], $type); $tpl['PUT:DataSourceName'] = "<input type='text' size='35' name='name' value='" . $tab['name'] . "'>"; $tpl['PUT:DataSourceHost'] = "<input type='text' size='35' name='host' value='" . $tab['host'] . "'>"; $tpl['PUT:DataSourcePort'] = "<input type='text' size='7' name='port' value='" . $tab['port'] . "'>"; $tpl['PUT:DataSourceUser'] = "******" . $tab['username'] . "'>"; $tpl['PUT:DataSourcePassword'] = "******" . $tab['password'] . "'>"; $tpl['PUT:DataSourceRePassword'] = "******" . $tab['password'] . "'>"; $tpl['PUT:DBName'] = "<input type='text' size='25' name='db_name' value='" . $tab['db_name'] . "'>"; $tpl['PUT:DBTable'] = "<input type='text' size='35' name='db_table' value='" . $tab['db_table'] . "'>"; $tpl['PUT:DBFieldUser'] = "******" . $tab['db_field_user'] . "'>"; $tpl['PUT:DBFieldPassword'] = "******" . $tab['db_field_password'] . "'>"; $tpl['PUT:LDAPBase'] = "<input type='text' size='35' name='ldap_base' value='" . $tab['ldap_base'] . "'>"; $tpl['BUTTON:Cancel'] = "<input type='button' class='button-red' value='" . $language["Cancel"] . "' onclick='javascript:sumo_ajax_get(\"network\",\"?module=network&action=view_datasource&id=" . $tab['id'] . "\");'>"; $tpl['LINK:Add'] = sumo_verify_permissions(4, 'sumo') ? sumo_get_action_icon("", "add_datasource", "network.content", "?module=network&action=new_datasource&decoration=false") : sumo_get_action_icon("", "add_datasource"); $tpl['LINK:Edit'] = sumo_get_action_icon("", "edit_datasource"); $tpl['LINK:Remove'] = sumo_verify_permissions(4, 'sumo') && $tab['id'] > 1 ? $delete : sumo_get_action_icon("", "remove_datasource"); /* $visibility['DatabaseOptions'] = $tab['db_name'] ? true : false; $visibility['LDAPOptions'] = $tab['ldap_base'] ? true : false; $tpl['LINK:DatabaseOptions'] = sumo_get_action_link('network.modify_datasource', 'DatabaseOptions', $visibility['DatabaseOptions']); $tpl['LINK:LDAPOptions'] = sumo_get_action_link('network.modify_datasource', 'LDAPOptions', $visibility['LDAPOptions']); */ $visibility['DatabaseOptions'] = $_POST['DatabaseOptions_visibility'] ? 1 : 0; $visibility['LDAPOptions'] = $_POST['LDAPOptions_visibility'] ? 1 : 0; $tpl['LINK:DatabaseOptions'] = '<div onclick=\'javascript:ShowHideSubModule("network.modify_datasource.DatabaseOptions");\'><input type="hidden" value="' . $visibility['DatabaseOptions'] . '" name="DatabaseOptions_visibility"></div>' . '<div style="visibility: hidden; position: absolute;" id="network.modify_datasource.DatabaseOptions">'; $tpl['LINK:LDAPOptions'] = '<div onclick=\'javascript:ShowHideSubModule("network.modify_datasource.LDAPOptions");\'><input type="hidden" value="' . $visibility['LDAPOptions'] . '" name="LDAPOptions_visibility"></div>' . '<div style="visibility: hidden; position: absolute;" id="network.modify_datasource.LDAPOptions">'; // Bugfix $tpl['GET:WindowScripts'] = $tab['db_name'] ? "setTimeout('ShowElement(\"network.modify_datasource.DatabaseOptions\")',100);" : "";
<?php /** * SUMO MODULE: Users | Add * * @version 0.5.0 * @link http://sumoam.sourceforge.net SUMO Access Manager * @author Alberto Basso <*****@*****.**> * @copyright Copyright © 2003-2009, Alberto Basso * @package SUMO * @category Console */ if (sumo_verify_permissions(5, $SUMO['user']['group'])) { $data = array(array('username', $_POST['user'], 1), array('name', $_POST['firstname']), array('name', $_POST['lastname']), array('active', $_POST['active'], 1), array('datasource_id', $_POST['datasource_id'], 1), array('email', $_POST['email']), array('language', $_POST['language']), array('usergroup', $_POST['newgroup'], 1), array('ip', $_POST['ip']), array('day_limit', $_POST['day_limit']), array('new_password', array($_POST['new_password'], $_POST['renew_password']))); $validate = sumo_validate_data($data, TRUE); // verify if user already exist if (sumo_verify_user_exist($_POST['user'])) { $validate = array(FALSE, sumo_get_message('W00028C', $_POST['user'])); } // verify if password is not null (for SUMO datasource) $ds = sumo_get_datasource_info($_POST['datasource_id']); if (!$_POST['new_password'] && $ds['type'] == 'SUMO') { $validate = array(FALSE, $language['NoPasswordForSumoDS']); } if ($validate[0]) { // Verify submittedd groups with current user group $available_group = sumo_get_available_group(); $newgroup = explode(":", $_POST['newgroup']); if (!in_array($newgroup[0], $available_group)) { $validate = array(FALSE, sumo_get_message('GroupNotAvailable', $newgroup[0])); }
* SUMO MODULE: Network | Edit Local IP Address * * @version 0.2.10 * @link http://sumoam.sourceforge.net SUMO Access Manager * @author Alberto Basso <*****@*****.**> * @copyright Copyright © 2003-2009, Alberto Basso * @package SUMO * @category Console */ $tab = sumo_get_intranet_ip_info($_GET['id'], 'id', FALSE); switch ($tab['type']) { case 'L': $type = $language['Locale']; break; case 'P': $type = $language['Proxy']; break; default: $type = $language['Unknow']; break; } $tpl['GET:UpdateForm'] = sumo_get_form_req('', 'modify_localip', 'id=' . $tab['id']); $tpl['PUT:LocalIPType'] = "<select name='type'>\n<option value='" . $tab['type'] . "'>" . $type . "</option>\n" . "<option value='L'>" . $language['Locale'] . "</option>\n<option value='P'>" . $language['Proxy'] . "</option>\n" . "</select>"; $tpl['PUT:IP'] = "<input type='text' size='25' name='ip' value='" . $tab['ip'] . "'>"; $tpl['BUTTON:Back'] = "<input type='button' class='button-red' value='" . $language["Back"] . "' onclick='javascript:sumo_ajax_get(\"network\",\"?module=network&action=view_localip&id=" . $tab['id'] . "\");'>"; $tpl['LINK:EditLocalIP'] = $language["Modify"]; if (sumo_verify_permissions(4, 'sumo')) { $tpl['LINK:Remove'] = "<a href='javascript:sumo_ajax_get(\"network\",\"?module=network&action=delete_localip&id=" . $tab['id'] . "\");' title='" . $language['Remove'] . "'>" . $language['Remove'] . "</a>"; } else { $tpl['LINK:Remove'] = $language['Remove']; }
} 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']); $tpl['PUT:Theme'] = sumo_put_themes($tab['theme']); $tpl['PUT:Name'] = sumo_put_accesspoint_name($form_name, sumo_get_accesspoint_name($tab['name'])); $tpl['PUT:Filtering'] = "<input type='checkbox' name='filtering' " . $checked['filtering'] . ">"; $tpl['PUT:ChangePwd'] = $is_console ? "<input type='checkbox' name='change_pwd' disabled " . $checked['change_pwd'] . " />" : "<input type='checkbox' name='change_pwd' " . $checked['change_pwd'] . " />"; $tpl['PUT:Registration'] = $is_console ? "<input type='checkbox' name='registration' disabled " . $checked['registration'] . " " : "<input type='checkbox' name='registration' " . $checked['registration'] . " " . "onclick='if(document.{$form_name}.registration.checked==true){document.{$form_name}.reg_group.disabled=false;}else{document.{$form_name}.reg_group.disabled=true;}' />"; $tpl['PUT:Path'] = $tab['id'] > 1 ? "<input type='text' size='50' name='path' value='" . $tab['path'] . "' onchange='if(this.form.path.value!=\"{$path_console}\"){document.{$form_name}.filtering.disabled=false;}else{document.{$form_name}.filtering.disabled=true;}' />" : "<input type='hidden' name='path' value='" . $tab['path'] . "'><input type='text' size='50' name='path2' value='" . $tab['path'] . "' disabled>"; $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:PwdEncrypt'] = "<input type='checkbox' name='pwd_encrypt' " . $checked['pwd_encrypt'] . " " . "onclick='if(document.{$form_name}.pwd_encrypt.checked==true){document.{$form_name}.http_auth.checked=false;}' />"; $tpl['LINK:Add'] = sumo_verify_permissions(5, 'sumo') ? sumo_get_action_icon("", "add", "accesspoints.content", "?module=accesspoints&action=new&decoration=false") : sumo_get_action_icon("", "add"); $tpl['LINK:Edit'] = sumo_get_action_icon("", "edit"); $tpl['LINK:Remove'] = $delete; $tpl['BUTTON:Back'] = "<input type='button' class='button-red' value='" . $language["Back"] . "' onclick='javascript:sumo_ajax_get(\"accesspoints\",\"?module=accesspoints&action=view&id=" . $tab['id'] . "\");'>"; // Use REQUEST method because when delete a group on AP // the command came from a link $visibility['SecurityOptions'] = $_REQUEST['SecurityOptions_visibility'] ? true : false; $visibility['LayoutOptions'] = $_REQUEST['LayoutOptions_visibility'] ? true : false; $tpl['LINK:SecurityOptions'] = sumo_get_action_link($form_name, 'SecurityOptions', $visibility['SecurityOptions']); $tpl['LINK:LayoutOptions'] = sumo_get_action_link($form_name, 'LayoutOptions', $visibility['LayoutOptions']);
$tpl['PUT:Language'] = sumo_get_available_languages(1, 0, $tab['language']); } else { $tpl['PUT:FirstName'] = htmlspecialchars($tab['firstname'], ENT_QUOTES); $tpl['PUT:LastName'] = htmlspecialchars($tab['lastname'], ENT_QUOTES); $tpl['PUT:Language'] = ucfirst(sumo_get_string_languages($tab['language'])); $tpl['PUT:Email'] = "<a href='mailto:" . $tab['email'] . "' title='Send e-mail'>" . $tab['email'] . "</a>"; $tpl['PUT:UserImage'] = ""; } // to change IP if (in_array('sumo', $SUMO['user']['group']) || $SUMO['user']['id'] == $tab['owner_id']) { $tpl['PUT:IP'] = "<textarea rows='2' cols='40' name='ip'>" . implode("; ", $tab['ip']) . "</textarea>"; } else { $tpl['PUT:IP'] = implode("; ", $tab['ip']); } // Remove if ((in_array('sumo', $SUMO['user']['group']) || sumo_verify_permissions(7, $tab['group']) || $SUMO['user']['id'] == $tab['owner_id']) && $tab['username'] != 'sumo' && $tab['username'] != $SUMO['user']['user']) { $msg = sumo_get_simple_rand_string(4, "123456789"); $tpl['LINK:Remove'] = "<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['username'], htmlspecialchars($tab['firstname'], ENT_QUOTES), htmlspecialchars($tab['lastname'], ENT_QUOTES)))) . "', \n\t\t\t\t\t\t\t 'h', 0,\n\t\t\t\t\t\t\t '" . base64_encode(sumo_get_form_req('', 'delete', 'id=' . $tab['id'])) . "',\n\t\t\t\t\t\t\t '" . base64_encode('') . "',\n\t\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\t '" . base64_encode("<input type='submit' value='" . $language['Ok'] . "' onclick='javascript:sumo_remove_window(\"msg{$msg}\");'>") . "');\" class='button'>" . "<img src='themes/" . $SUMO['page']['theme'] . "/images/modules/users/delete.png' vspace='4'><br>" . $language['Remove'] . "</a>" . "</div>"; } else { $tpl['LINK:Remove'] = sumo_get_action_icon("users", "delete"); } // on submit $submit = 'if(document.ModifyUsers.new_password.value!="")' . '{document.ModifyUsers.new_password.value=hex_sha1(document.ModifyUsers.new_password.value);' . 'document.ModifyUsers.renew_password.value=hex_sha1(document.ModifyUsers.renew_password.value);}'; // ...to change password if (($SUMO['user']['user'] == $tab['username'] || $SUMO['user']['id'] == $tab['owner_id'] || $SUMO['user']['user'] == 'sumo') && in_array($datasource['type'], array('SUMO', 'MySQLUsers', 'Joomla15'))) { $tpl['PUT:NewPassword'] = "******"; $tpl['PUT:ReNewPassword'] = "******"; $tpl['GET:UpdateForm'] = sumo_get_form_req('', 'modify', 'id=' . $tab['id']); } // Pwd expiration date if ($SUMO['config']['accounts']['password']['life'] > 0 && $datasource['type'] == 'SUMO' && $tab['pwd_updated']) {
// No window decoration if needed $action_error = false; $module['file']['action'] = SUMO_PATH_MODULE . '/actions/action.' . $action . '.php'; if (isset($_GET['decoration'])) { $decoration = $_GET['decoration'] == 'false' ? false : true; } // Verify if exist required action file if (!file_exists($module['file']['action'])) { $tpl['MESSAGE:H'] = sumo_get_message('UnknowAction', htmlentities($action)); } else { // Verify action permissions if (!empty($ma[$action]['level']) && $action_error != true) { $level = $ma[$action]['level']; $group = $ma[$action]['group'] ? $ma[$action]['group'] : $SUMO['user']['group']; $user = $ma[$action]['user'] ? $ma[$action]['user'] : $SUMO['user']['user']; if (!sumo_verify_permissions($level, $group, $user)) { $action_error = true; $tpl['MESSAGE:H'] = sumo_get_message('AccessDeniedDetails', array($user, $group, $level)); } } } if (!$action_error) { // Load module file if exist if (file_exists($module['file']['module'])) { require $module['file']['module']; } // Load action file require $module['file']['action']; } // export data on file // NOTE: no window is necessary, but not display permission error
<?php /** * SUMO MODULE: Network | View Local IP address * * @version 0.4.0 * @link http://sumoam.sourceforge.net SUMO Access Manager * @author Alberto Basso <*****@*****.**> * @copyright Copyright © 2003-2009, Alberto Basso * @package SUMO * @category Console */ $tab = sumo_get_intranet_ip_info($_GET['id'], 'id', FALSE); switch ($tab['type']) { case 'L': $type = $language['Locale']; break; case 'P': $type = $language['Proxy']; break; default: $type = $language['Unknow']; break; } $tpl = array('GET:Theme' => $SUMO['page']['theme'], 'GET:MenuModule' => $tpl['GET:MenuModule'], 'GET:LocalIPType' => $type, 'GET:IP' => $tab['ip'], 'LINK:EditLocalIP' => "<a href='javascript:sumo_ajax_get(\"network\",\"?module=network&action=edit_localip&id=" . $tab['id'] . "\");' title='" . $language["EditDataSource"] . "'>" . $language["Modify"] . "</a>", 'LINK:Remove' => sumo_verify_permissions(4, 'sumo') ? "<a href='javascript:sumo_ajax_get(\"network\",\"?module=network&action=delete_localip&id=" . $tab['id'] . "\");' title='" . $language['Remove'] . "'>" . $language['Remove'] . "</a>" : $language['Remove'], 'BUTTON:Back' => "<input type='button' class='button-red' value='" . $language["Back"] . "' onclick='javascript:sumo_ajax_get(\"network\",\"?module=network&action=ilist\");'>");
*/ $tab = sumo_get_node_info($_GET['id'], 'id', FALSE); $tpl['GET:UpdateForm'] = sumo_get_form_req('', 'modify_node', 'id=' . $tab['id']); $tpl['PUT:Protocol'] = sumo_put_node_protocol($tab['protocol']); $tpl['PUT:NodeName'] = "<input type='text' size='25' name='name' value='" . $tab['name'] . "'>"; $tpl['PUT:Host'] = "<input type='text' size='25' name='host' value='" . $tab['host'] . "'>"; $tpl['PUT:Port'] = "<input type='text' size='7' name='port' value='" . $tab['port'] . "'>"; $tpl['PUT:SumoPath'] = "<input type='text' size='25' name='sumo_path' value='" . $tab['sumo_path'] . "'>"; $tpl['BUTTON:Back'] = "<input type='button' class='button-red' value='" . $language["Back"] . "' onclick='javascript:sumo_ajax_get(\"network\",\"?module=network&action=view_node&id=" . $tab['id'] . "\");'>"; $tpl['LINK:Add'] = sumo_verify_permissions(4, 'sumo') ? sumo_get_action_icon("network", "add_node", "network.content", "?module=network&action=new_node&decoration=false") : sumo_get_action_icon("", "add_node"); $tpl['LINK:Edit'] = sumo_get_action_icon("", "edit_node"); // Change status if ($tab['active']) { $tpl['GET:Status'] = "<font class='status-green'>" . $language['Active'] . "</font>"; $tpl['PUT:Status'] = "<select name='status'>\n<option value='1'>" . $language['Enable'] . "</option>\n<option value='0'>" . $language['Disable'] . "</option>\n</select>"; } else { $tpl['GET:Status'] = "<font class='status-red'>" . $language['Disabled'] . "</font>"; $tpl['PUT:Status'] = "<select name='status'>\n<option value='0'>" . $language['Disable'] . "</option>\n<option value='1'>" . $language['Enable'] . "</option>\n</select>"; } // if it's current node if ($tab['ip'] == $SUMO['server']['ip']) { $tpl['MESSAGE:M'] = $language['NodeWarning']; $tpl['PUT:Host'] = $tab['ip'] . "<input type='hidden' name='host' value='" . $tab['host'] . "'>"; $tpl['PUT:Status'] = ""; } if (sumo_verify_permissions(7, 'sumo') && $tab['id'] > 1) { $msg = sumo_get_simple_rand_string(4, "123456789"); $tpl['LINK:Remove'] = "<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('AreYouSureDeleteNode', $tab['name'])) . "', \n\t\t\t\t\t\t\t\t 'h', 0, \n\t\t\t\t\t\t\t\t '" . base64_encode(sumo_get_form_req('', 'erase_node', 'id=' . $tab['id'])) . "',\n\t\t\t\t\t\t\t\t '" . base64_encode('') . "',\n\t\t\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\t\t '" . base64_encode("<input type='submit' value='" . $language['Ok'] . "' onclick='javascript:sumo_remove_window(\"msg{$msg}\");' class='button'>") . "'\n\t\t\t\t\t\t\t\t);\">" . "<img src='themes/" . $SUMO['page']['theme'] . "/images/modules/network/remove_node.png' vspace='4'><br>" . $language['Remove'] . "</a>" . "</div>"; } else { $tpl['LINK:Remove'] = sumo_get_action_icon("", "remove_node"); }
if ($col[8]) { $list .= " <td class='" . $style . "' align='center'><img src='themes/" . $SUMO['page']['theme'] . "/images/modules/accesspoints/" . $pwd_encrypt . ".gif'></td>\n"; } if ($col[9]) { $list .= " <td class='" . $style . "' align='center'><img src='themes/" . $SUMO['page']['theme'] . "/images/modules/accesspoints/" . $registration . ".gif'></td>\n"; } if ($col[10]) { $list .= " <td class='" . $style . "' align='center'>" . $tab['reg_group'] . "</td>\n"; } if ($col[11]) { $list .= " <td class='" . $style . "' align='center'><img src='themes/" . $SUMO['page']['theme'] . "/images/modules/accesspoints/" . $change_pwd . ".gif'></td>\n"; } if ($col[12]) { $list .= " <td class='" . $style . "'>" . $theme . "</td>\n"; } if ($col[13]) { $list .= " <td class='" . $style . "'>" . $created . "</td>\n"; } if ($col[14]) { $list .= " <td class='" . $style . "'>" . $updated . "</td>\n"; } $list .= "</tr>\n"; } $list .= "</table>"; } else { $list = "<div class='no-results'>" . $language['AccesspointsNotFound'] . "</div>"; } $searched = $search ? $_SESSION['search_accesspoints_list'] : ''; // Template Data $tpl = array('MESSAGE:H' => $tpl['MESSAGE:H'], 'MESSAGE:M' => $tpl['MESSAGE:M'], 'MESSAGE:L' => $tpl['MESSAGE:L'], 'GET:MenuModule' => $tpl['GET:MenuModule'], 'GET:AccessPointsList' => $list, 'GET:TotalRows' => number_format($tot, 0, "", "."), 'GET:StartRow' => number_format($_SESSION['start_accesspoints_list'], 0, "", "."), 'GET:EndRow' => number_format($_SESSION['start_accesspoints_list'] + $vis, 0, "", "."), 'GET:PagingResults' => sumo_paging_results($tot, $vis, $_SESSION['rows_accesspoints_list'], 5, $_SESSION['start_accesspoints_list'], 'start_accesspoints_list'), 'GET:TableSettings' => sumo_get_table_settings($table['data']['list']), 'GET:SearchForm' => sumo_get_form_search($searched), 'GET:ExportData' => sumo_get_export_data(), 'LINK:AddAccessPoint' => sumo_verify_permissions(5, 'sumo') ? sumo_get_action_icon("", "add", "accesspoints.content", "?module=accesspoints&action=new&decoration=false") : sumo_get_action_icon("", "add")); $tpl['GET:Pagination'] = $tot > 0 ? $tpl['GET:StartRow'] . "..." . $tpl['GET:EndRow'] . " " . $language['of'] . " <b>" . $tpl['GET:TotalRows'] . "</b>" : "";