本文整理汇总了PHP中Acl::am_i_proadmin方法的典型用法代码示例。如果您正苦于以下问题:PHP Acl::am_i_proadmin方法的具体用法?PHP Acl::am_i_proadmin怎么用?PHP Acl::am_i_proadmin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Acl
的用法示例。
在下文中一共展示了Acl::am_i_proadmin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: strtotime
$to_time = strtotime($startDate);
$from_time = strtotime($endDate);
return floor(abs($to_time - $from_time) / 60);
}
Session::useractive('../session/login.php');
$conf = $GLOBALS['CONF'];
/* Connect to db */
$db = new ossim_db();
$conn = $db->connect();
/* Version */
$pro = Session::is_pro();
$mode = empty($_SESSION['user_in_db']) ? 'insert' : 'update';
$login = POST('login') != '' ? POST('login') : $_SESSION['user_in_db'];
$myself = Session::get_user_info($conn);
$am_i_admin = Session::am_i_admin();
$am_i_proadmin = $pro && Acl::am_i_proadmin() ? TRUE : FALSE;
$is_my_profile = $login == $myself->get_login() ? TRUE : FALSE;
$validate = array('uuid' => array('validation' => 'OSS_HEX, OSS_NULLABLE', 'e_message' => 'illegal:' . _('UUID')), 'login' => array('validation' => 'OSS_USER_2', 'e_message' => 'illegal:' . _('User login')), 'user_name' => array('validation' => 'OSS_ALPHA, OSS_PUNC, OSS_AT', 'e_message' => 'illegal:' . _('User name')), 'email' => array('validation' => 'OSS_MAIL_ADDR, OSS_NULLABLE', 'e_message' => 'illegal:' . _('User e-mail')), 'language' => array('validation' => 'OSS_ALPHA, OSS_PUNC, OSS_AT, OSS_NULLABLE', 'e_message' => 'illegal:' . _('Language')), 'tzone' => array('validation' => "OSS_ALPHA, OSS_SCORE, '\\/', '\\+'", 'e_message' => 'illegal:' . _('Timezone')), 'login_method' => array('validation' => 'ldap, pass', 'e_message' => 'illegal:' . _('Login method')), 'c_pass' => array('validation' => 'OSS_PASSWORD', 'e_message' => 'illegal:' . _('Current password')), 'pass1' => array('validation' => 'OSS_PASSWORD', 'e_message' => 'illegal:' . _('Password')), 'pass2' => array('validation' => 'OSS_PASSWORD', 'e_message' => 'illegal:' . _('Retype password')), 'last_pass_change' => array('validation' => 'OSS_DIGIT, OSS_PUNC_EXT', 'e_message' => 'illegal:' . _('Last pass change')), 'is_admin' => array('validation' => 'OSS_DIGIT, OSS_NULLABLE', 'e_message' => 'illegal:' . _('Global admin')), 'template_id' => array('validation' => 'OSS_HEX', 'e_message' => 'illegal:' . _('Menu template')), 'assets[]' => array('validation' => 'OSS_HEX, OSS_NULLABLE', 'e_message' => 'illegal:' . _('Assets')), 'sensors[]' => array('validation' => 'OSS_HEX, OSS_NULLABLE', 'e_message' => 'illegal:' . _('Sensors')));
if ($mode == 'update') {
$validate['pass1']['validation'] = 'OSS_PASSWORD, OSS_NULLABLE';
$validate['pass2']['validation'] = 'OSS_PASSWORD, OSS_NULLABLE';
}
if ($pro && !$is_my_profile) {
$validate['entities[]'] = array('validation' => 'OSS_HEX', 'e_message' => 'illegal:' . _('Entities'));
} else {
$validate['company'] = array('validation' => 'OSS_ALPHA, OSS_PUNC, OSS_AT, OSS_NULLABLE', 'e_message' => 'illegal:' . _('Company'));
$validate['department'] = array('validation' => 'OSS_ALPHA, OSS_PUNC, OSS_AT, OSS_NULLABLE', 'e_message' => 'illegal:' . _('Department'));
}
/* AJAX validation using GET method */
if (GET('ajax_validation') == TRUE) {
$data['status'] = 'OK';
示例2: load_layout
require_once 'languages.inc';
Session::logcheck('configuration-menu', 'ConfigurationUsers');
// Load column layout
require_once '../conf/layout.php';
$category = 'policy';
$name_layout = 'host_layout';
$layout = load_layout($name_layout, $category);
$db = new ossim_db();
$conn = $db->connect();
$action = REQUEST('action');
$user_id = REQUEST('user_id');
$language = POST('language');
if (ossim_error()) {
die(ossim_error());
}
$proadmin = Session::am_i_admin() || Session::is_pro() && Acl::am_i_proadmin();
// admin user or pro admin
/* Allowed actions:
- Enable/disable user
- Expire session
- Change language
*/
if ($action != "" && $user_id != '') {
$myself = Session::get_session_user();
ossim_valid($user_id, OSS_USER, 'illegal:' . _('User ID'));
ossim_valid($action, OSS_ALPHA, OSS_SCORE, 'illegal:' . _('Action'));
if (ossim_error()) {
echo ossim_error();
exit;
}
示例3: edit_autoenable
function edit_autoenable($sid)
{
global $dbconn, $username, $version;
navbar($sid);
$query = "select id, name, description, autoenable, type, owner, update_host_tracker\n FROM vuln_nessus_settings where id={$sid}";
$dbconn->SetFetchMode(ADODB_FETCH_BOTH);
$result = $dbconn->execute($query);
echo <<<EOT
<form method="post" action="settings.php" id="profile_config">
<input type="hidden" name="type" value="update">
<input type="hidden" name="sid" value="{$sid}">
EOT;
list($sid, $sname, $sdescription, $sautoenable, $stype, $sowner, $tracker) = $result->fields;
$sname = mb_convert_encoding($sname, 'ISO-8859-1', 'UTF-8');
//if($stype=='G') { $stc = "checked"; } else { $stc = ""; }
if (valid_hex32($sowner)) {
$user_entity = $sowner;
} else {
$user = $sowner;
}
$old_user = $sowner;
if ($tracker == '1') {
$cktracker = "checked";
} else {
$cktracker = "";
}
echo <<<EOT
<input type="hidden" name="old_owner" value="{$old_user}">
<input type="hidden" name="old_name" value="{$sname}">
<center>
<table cellspacing="2" cellpadding="4">
<tr>
EOT;
echo "<th>" . _("Name") . ":</th>";
echo '
<td><input type="text" name="sname" value="' . $sname . '" size=50/>
</tr>
<tr>
';
echo "<th>" . _("Description") . ":</th>";
echo '
<td><input type="text" name="sdescription" value="' . $sdescription . '" size=50/></td>
</tr>';
$users = Session::get_users_to_assign($dbconn);
$entities = Session::am_i_admin() || $pro && Acl::am_i_proadmin() ? Session::get_entities_to_assign($dbconn) : null;
?>
<tr>
<th><?php
echo _("Make this profile available for");
?>
:</th>
<td>
<table cellspacing="0" cellpadding="0" align='center' class="transparent">
<tr>
<td class='nobborder'><span style='margin-right:3px'><?php
echo _("User:");
?>
</span></td>
<td class='nobborder'>
<select name="user" style="width:150px" id="user" onchange="switch_user('user');return false;" >
<?php
$num_users = 0;
$current_user = Session::get_session_user();
if (!Session::am_i_admin()) {
$user = $user == "" && $entity == "" ? $current_user : $user;
}
foreach ($users as $k => $v) {
$login = $v->get_login();
$selected = $login == $user ? "selected='selected'" : "";
$options .= "<option value='" . $login . "' {$selected}>{$login}</option>\n";
$num_users++;
}
if ($num_users == 0) {
echo "<option value='-1' style='text-align:center !important;'>- " . _("No users found") . " -</option>";
} else {
echo "<option value='-1' style='text-align:center !important;'>- " . _("Select users") . " -</option>";
if (Session::am_i_admin()) {
$default_selected = ($user == "" || intval($user) == 0) && $entity == "" ? "selected='selected'" : "";
echo "<option value='0' {$default_selected}>" . _("ALL") . "</option>\n";
}
echo $options;
}
?>
</select>
</td>
<?php
if (!empty($entities)) {
?>
<td style='text-align:center; border:none; !important'><span style='padding:5px;'><?php
echo _("OR");
?>
<span></td>
<td class='nobborder'><span style='margin-right:3px'><?php
echo _("Entity:");
?>
</span></td>
<td class='nobborder'>
//.........这里部分代码省略.........
示例4: _
<td class='right'>
<input type="button" class="av_b_secondary small" value="<?php
echo _('Add New');
?>
" onclick="javascript:add_frw_server();return false;"/>
</td>
</tr>
</table>
</td>
</tr>
<?php
}
?>
<?php
if ($mssp && $pro && (Session::am_i_admin() || Acl::am_i_proadmin())) {
$tooltip = "<ul class='tip'>\n \t\t\t\t\t\t\t<li>" . _('Right-click on engine nodes to change its name') . "</li>\n \t\t\t\t\t\t\t<li>" . _('Drag and drop contexts between engines') . "</li>\n \t\t\t\t\t\t</ul>";
?>
<tr id='engine_notification'>
<td colspan=2 class="noborder">
<div></div>
</td>
</tr>
<tr id='engines_server' >
<th style="text-decoration:underline">
<label for='eng_name'><?php
echo _('Correlation Options');
?>
</label>
<a href='javascript:;' class='tiptip' title="<?php
echo $tooltip;
示例5: get_targets
$select_targets = get_targets($conn, $database['meth_TARGET']);
} else {
if ($action == 'delete_scan') {
$query = 'SELECT username, name, id, scan_SERVER, report_id, status FROM vuln_jobs WHERE id=?';
$params = array($job_id);
$result = $conn->execute($query, $params);
$username = $result->fields['username'];
$job_name = $result->fields['name'];
$kill_id = $result->fields['id'];
$nserver_id = $result->fields['scan_SERVER'];
$report_id = $result->fields['report_id'];
$can_i_delete = FALSE;
if (Session::am_i_admin() || Session::get_session_user() == $username) {
$can_i_delete = TRUE;
} else {
if (Session::is_pro() && Acl::am_i_proadmin()) {
$user_vision = !isset($_SESSION['_user_vision']) ? Acl::get_user_vision($conn) : $_SESSION['_user_vision'];
$my_entities_admin = array_keys($user_vision['entity_admin']);
if (in_array($username, $my_entities_admin)) {
$can_i_delete = TRUE;
}
}
}
if ($can_i_delete) {
$query = 'DELETE FROM vuln_jobs WHERE id=?';
$params = array($kill_id);
$result = $conn->execute($query, $params);
$query = 'DELETE FROM vuln_nessus_reports WHERE report_id=?';
$params = array($report_id);
$result = $conn->execute($query, $params);
$query = 'DELETE FROM vuln_nessus_report_stats WHERE report_id=?';
示例6: select_profile
function select_profile()
{
global $sid, $username, $dbconn, $version, $nessus_path;
$used_sids = array();
if (preg_match("/omp\\s*\$/i", $nessus_path)) {
$omp = new OMP();
$used_sids = $omp->get_used_sids();
}
$entities_nt = array();
$query = "SELECT ae.id as eid, ae.name as ename, aet.name as etype FROM acl_entities AS ae, acl_entities_types AS aet WHERE ae.type = aet.id";
$result_entities = $dbconn->Execute($query);
while (!$result_entities->EOF) {
$entities_nt[$result_entities->fields['eid']] = $result_entities->fields['ename'] . " [" . $result_entities->fields['etype'] . "]";
$result_entities->MoveNext();
}
$query = "";
$normal_user_pro = false;
if ($username == "admin") {
$query = "SELECT id, name, description, owner, type FROM vuln_nessus_settings \n WHERE deleted != '1' ORDER BY name";
} else {
if (preg_match("/pro|demo/i", $version)) {
if (Acl::am_i_proadmin()) {
$pro_users = array();
$entities_list = array();
//list($entities_admin,$num) = Acl::get_entities_admin($dbconn,Session::get_session_user());
//$entities_list = array_keys($entities_admin);
$entities_list = Acl::get_user_entities($current_user);
$users = Acl::get_my_users($dbconn, Session::get_session_user());
foreach ($users as $us) {
$pro_users[] = $us["login"];
}
$query = "SELECT id, name, description, owner, type FROM vuln_nessus_settings \n WHERE deleted != '1' and (name='Default' or owner in ('0','" . implode("', '", array_merge($entities_list, $pro_users)) . "')) ORDER BY name";
} else {
$tmp = array();
$entities = Acl::get_user_entities($username);
foreach ($entities as $entity) {
$tmp[] = "'" . $entity . "'";
}
if (count($tmp) > 0) {
$user_where = "owner in ('0','{$username}'," . implode(", ", $tmp) . ")";
} else {
$user_where = "owner in ('0','{$username}')";
}
$query = "SELECT id, name, description, owner, type FROM vuln_nessus_settings \n WHERE deleted != '1' and (name='Default' or {$user_where}) ORDER BY name";
$normal_user_pro = true;
}
} else {
$query = "SELECT id, name, description, owner, type FROM vuln_nessus_settings \n WHERE deleted != '1' and (name='Default' or owner in ('0','{$username}')) ORDER BY name";
}
}
//var_dump($query);
$result = $dbconn->execute($query);
//echo $query;
echo "<CENTER>";
echo "<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"800\"><tr><td class=\"headerpr\" style=\"border:0;\">" . _("Vulnerability Scan Profiles") . "</td></tr></table>";
echo "<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"800\"><tr><td class=\"noborder\">";
echo "<p>";
echo _("Please select a profile to edit") . ":";
echo "</p>";
echo "<table align='center'>";
echo "<tr>";
if ($username == "admin" || Session::am_i_admin()) {
echo "<th>" . _("Available for") . "</th>";
}
echo " <th>" . _("Profile") . "</th>";
echo " <th>" . _("Description") . "</th>";
echo " <th>" . _("Action") . "</th>";
echo "</tr>";
while (!$result->EOF) {
//<td>$sowner</td>
//<td>$stype</td>
list($sid, $sname, $sdescription, $sowner, $stype) = $result->fields;
echo "<tr>";
if ($username == "admin" || Session::am_i_admin()) {
if ($sowner == "0") {
echo "<td>" . _("All") . "</td>";
} elseif (is_numeric($sowner)) {
echo "<td style='padding:0px 2px 0px 2px;'>" . $entities_nt[$sowner] . "</td>";
} else {
echo "<td>" . html_entity_decode($sowner) . "</td>";
}
}
echo "<td>" . html_entity_decode($sname) . "</td>";
echo "<td>" . html_entity_decode($sdescription) . "</td>";
echo "<td>";
//var_dump($normal_user_pro);
//var_dump($sowner);
//var_dump($username);
//var_dump($used_sids);
if ($normal_user_pro && $sowner != $username && $sname != "Default") {
echo " ";
} elseif ($username == "admin" || Session::am_i_admin()) {
if (!in_array($sid, $used_sids)) {
echo "<a href=\"settings.php?disp=edit&&sid={$sid}\"><img src=\"images/pencil.png\"></a>";
echo "<a href=\"settings.php?disp=edit&op=delete&sid={$sid}\" onclick=\"return confirmDelete();\"><img src=\"images/delete.gif\"></a>";
} else {
echo "<img src=\"images/pencil.png\" title=\"" . _("This profile is being used by a running job now") . "\" style=\"filter:alpha(opacity=50);-moz-opacity:0.5;-khtml-opacity: 0.5;opacity: 0.5;\">";
echo "<img src=\"images/delete.gif\" title=\"" . _("This profile is being used by a running job now") . "\" style=\"filter:alpha(opacity=50);-moz-opacity:0.5;-khtml-opacity: 0.5;opacity: 0.5;\">";
}
} elseif ($sname == "Default") {
//.........这里部分代码省略.........
示例7: ossim_db
Web_indicator::set_on('Reload_servers');
$return['error'] = FALSE;
$return['data'] = '';
return $return;
}
$login = Session::get_session_user();
$db = new ossim_db();
$conn = $db->connect();
$action = POST('action');
$data = POST('data');
ossim_valid($action, OSS_DIGIT, 'illegal:' . _('Action'));
if (ossim_error()) {
die(ossim_error());
}
if ($action != '' && isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
if (!Session::is_pro() || !Session::am_i_admin() && !Acl::am_i_proadmin()) {
$response['error'] = TRUE;
$response['msg'] = _('You do not have permission to do this action');
} else {
switch ($action) {
case 1:
$response = change_ctx_engine($conn, $data);
break;
case 2:
$response = change_engine_name($conn, $data);
break;
case 3:
$response = insert_engine($conn, $data);
break;
case 4:
$response = delete_engine($conn, $data);
示例8: clone_tab
*
*
* On Debian GNU/Linux systems, the complete text of the GNU General
* Public License can be found in `/usr/share/common-licenses/GPL-2'.
*
* Otherwise you can read it here: http://www.gnu.org/licenses/gpl-2.0.txt
*
*/
require_once 'av_init.php';
//First we check we have session active
Session::useractive();
//Then we check the permissions
$cond1 = Session::logcheck_bool("dashboard-menu", "ControlPanelExecutive");
$cond1 = $cond1 && Session::logcheck_bool("dashboard-menu", "ControlPanelExecutiveEdit");
$cond2 = !Session::am_i_admin();
$cond3 = Session::is_pro() && !Acl::am_i_proadmin();
if (!$cond1 && $cond2 && $cond3) {
$response['error'] = TRUE;
$response['msg'] = _('You do not have permissions to see this section');
echo json_encode($response);
exit - 1;
}
require_once AV_MAIN_ROOT_PATH . '/dashboard/sections/widgets/widget_common.php';
/****************************************************************************************************************/
/* */
/************************************************ TABS FUNTIONS *************************************************/
/* */
/****************************************************************************************************************/
function clone_tab($data)
{
$from = $data['from'];
示例9: elseif
}
?>
</td>
</tr>
</table>
<input type="hidden" name="action" value="save" />
<input type="hidden" name="name" value="<?php
echo $name;
?>
" />
<input type="hidden" name="url" value="<?php
echo $url;
?>
" />
<?php
} elseif (Acl::am_i_proadmin()) {
// pro admin
//users
$users_admin = Acl::get_my_users($dbconn, Session::get_session_user());
foreach ($users_admin as $u) {
// if($u["login"]!=Session::get_session_user()){
$users_pro_login[] = $u["login"];
// }
}
//if(!in_array(Session::get_session_user(), $users_pro_login) && $incident_in_charge!=Session::get_session_user()) $users_pro_login[] = Session::get_session_user();
//entities
list($entities_all, $num_entities) = Acl::get_entities($dbconn);
list($entities_admin, $num) = Acl::get_entities_admin($dbconn, Session::get_session_user());
$entities_list = array_keys($entities_admin);
$entities_types_aux = Acl::get_entities_types($dbconn);
$entities_types = array();
示例10:
<a href='view.php?map=<?php
echo $n;
?>
'><img src='maps/<?php
echo $ico;
?>
' border='<?php
echo $default_map == $n ? "1" : "0";
?>
' width=150 height=150></a>
</td>
</tr>
<tr>
<td align="center">
<?php
if (Session::am_i_admin() || preg_match("/pro|demo/i", $version) && Acl::am_i_proadmin()) {
?>
<a class="greyboxo" href="change_user.php?id_map=<?php
echo $n;
?>
" title="<?php
echo "Change owner";
?>
"><img src="../pixmaps/group.png" title="<?php
_("Change owner");
?>
" alt="<?php
_("Change owner");
?>
" border="0"></a>
<?php
示例11: count
<select name="login">
<?php
$current_user = Session::get_session_user();
$number_users = count($users);
if (Session::am_i_admin()) {
$filtered_users = $users;
} else {
foreach ($users as $u) {
$login = $u->get_login();
if ($login == $current_user) {
$filtered_users[] = $u;
} else {
if (!Session::is_admin($conn, $login)) {
if ($pro && !Acl::am_i_proadmin() && !Acl::is_proadmin($conn, $login) > 0) {
$filtered_users[] = $u;
} elseif ($pro && Acl::am_i_proadmin()) {
$filtered_users[] = $u;
}
}
}
}
}
if ($number_users == 0) {
?>
<option value="">- <?php
echo _("No users found");
?>
-</option>
<?php
}
foreach ($filtered_users as $u) {
示例12: array
$configuration = 0;
if (Session::menu_perms("MenuConfiguration", "ConfigurationMain")) {
$configuration = 1;
$menu["Configuration"][] = array("name" => gettext("Main"), "id" => "Main", "url" => "conf/main.php");
$hmenu["Main"][] = array("name" => gettext("Simple"), "id" => "Main", "url" => "conf/main.php", "help" => "javascript:top.topmenu.new_wind('http://ossim.net/dokuwiki/doku.php?id=user_manual:configuration:configuration','Help');");
$hmenu["Main"][] = array("name" => gettext("Advanced"), "id" => "Advanced", "url" => "conf/main.php?adv=1", "help" => "javascript:top.topmenu.new_wind('http://ossim.net/dokuwiki/doku.php?id=user_manual:configuration:configuration','Help');");
if ($prodemo && Session::am_i_admin()) {
$hmenu["Main"][] = array("name" => gettext("Customization Wizard"), "id" => "Customize", "url" => "session/customize.php", "help" => "javascript:top.topmenu.new_wind('http://ossim.net/dokuwiki/doku.php?id=user_manual:configuration:customize','Help');");
}
}
if (Session::menu_perms("MenuConfiguration", "ConfigurationUsers")) {
$configuration = 1;
$users_path = $opensource ? "session/users.php" : "acl/users.php";
$menu["Configuration"][] = array("name" => gettext("Users"), "id" => "Users", "url" => $users_path);
$hmenu["Users"][] = array("name" => gettext("Configuration"), "id" => "Users", "url" => $users_path, "help" => "javascript:top.topmenu.new_wind('http://ossim.net/dokuwiki/doku.php?id=user_manual:configuration:users:users','Help');", "config" => "users");
if (!$opensource && (Session::am_i_admin() || Acl::am_i_proadmin())) {
$rmenu["Users"][] = array("name" => gettext("Entities"), "target" => "main", "url" => "../acl/entities.php");
$rmenu["Users"][] = array("name" => gettext("Templates"), "target" => "main", "url" => "../acl/templates.php");
$rmenu["Users"][] = array("name" => gettext("Password Policy"), "target" => "main", "url" => "../conf/main.php?adv=1&passpolicy=1&hmenu=Main&smenu=Advanced");
}
}
if (Session::menu_perms("MenuConfiguration", "ConfigurationUserActionLog")) {
$configuration = 1;
$hmenu["Users"][] = array("name" => gettext("User activity"), "id" => "User action logs", "url" => "conf/userlog.php", "help" => "javascript:top.topmenu.new_wind('http://ossim.net/dokuwiki/doku.php?id=user_manual:configuration:users:user_activity','Help');", "config" => "userlog");
}
if (Session::menu_perms("MenuConfiguration", "PolicyServers") || Session::menu_perms("MenuConfiguration", "PolicySensors")) {
$assets = 1;
if (Session::menu_perms("MenuConfiguration", "PolicySensors")) {
$menu["Configuration"][] = array("name" => gettext("SIEM Components"), "id" => "SIEM Components", "url" => "sensor/sensor.php");
} elseif (Session::menu_perms("MenuConfiguration", "PolicyServers")) {
$menu["Configuration"][] = array("name" => gettext("SIEM Components"), "id" => "SIEM Components", "url" => "server/server.php");
示例13: tab_discovery
//.........这里部分代码省略.........
while (!$result->EOF) {
list($SVRid, $sname, $shostIP) = $result->fields;
if (Session::am_i_admin() || Session::sensorAllowed($shostIP)) {
// $shostIP=="localhost" ||
$discovery .= "<option value=\"{$SVRid}\" ";
if ($editdata['scan_ASSIGNED'] != "" && $editdata['scan_ASSIGNED'] == $SVRid) {
$discovery .= " SELECTED";
}
if ($SVRid_selected == $SVRid) {
$discovery .= " SELECTED";
}
$discovery .= ">" . strtoupper($sname) . " [{$shostIP}] </option>";
}
$result->MoveNext();
}
$discovery .= <<<EOT
</select>
</td>
</tr>
<tr>
EOT;
$discovery .= "<td align='right' width='25%'>" . _("Profile") . ":</td>";
$discovery .= "<td style='text-align:left;'><select name='sid'>";
//$query = "SELECT distinct(t1.id), t1.name, t1.description
// FROM vuln_nessus_settings t1
// LEFT JOIN vuln_nessus_settings_users t2 ON t1.id = t2.sid
// WHERE t1.type = 'G' OR t2.username='$username'
// ORDER BY t1.name";
$query = "";
if ($username == "admin" || Session::am_i_admin()) {
$query = "SELECT distinct(t1.id), t1.name, t1.description \n FROM vuln_nessus_settings t1 WHERE deleted='0'\n ORDER BY t1.name";
} else {
if (preg_match("/pro|demo/i", $version)) {
if (Acl::am_i_proadmin()) {
$pro_users = array();
$entities_list = Acl::get_user_entities($current_user);
//list($entities_admin,$num) = Acl::get_entities_admin($dbconn,Session::get_session_user());
//$entities_list = array_keys($entities_admin);
$users = Acl::get_my_users($dbconn, Session::get_session_user());
foreach ($users as $us) {
$pro_users[] = $us["login"];
}
$query = "SELECT distinct(t1.id), t1.name, t1.description FROM vuln_nessus_settings t1\n WHERE deleted = '0' and (name='Default' or owner in ('0','" . implode("','", array_merge($entities_list, $pro_users)) . "')) ORDER BY t1.name";
} else {
$tmp = array();
$entities = Acl::get_user_entities($username);
foreach ($entities as $entity) {
$tmp[] = "'" . $entity . "'";
}
if (count($tmp) > 0) {
$user_where = "owner in ('0','{$username}'," . implode(", ", $tmp) . ")";
} else {
$user_where = "owner in ('0','{$username}')";
}
$query = "SELECT distinct(t1.id), t1.name, t1.description FROM vuln_nessus_settings t1\n WHERE deleted = '0' and (name='Default' or {$user_where}) ORDER BY t1.name";
}
} else {
$query = "SELECT distinct(t1.id), t1.name, t1.description FROM vuln_nessus_settings t1\n WHERE deleted = '0' and (name='Default' or owner in ('0','{$username}')) ORDER BY t1.name";
}
}
//var_dump($query);
$result = $dbconn->execute($query);
$job_profiles = array();
$id_found = false;
$ipr = 0;
while (!$result->EOF) {
示例14: tab_discovery
//.........这里部分代码省略.........
$discovery .= "<td style=\"text-align:left;\">{$nameout}</td>";
$discovery .= "</tr>";
list($sensor_list, $total) = Av_sensor::get_list($dbconn);
$discovery .= "<tr>";
$discovery .= "<td class='job_option'>" . Util::strong(_("Select Server") . ":") . "</td>";
$discovery .= "<td style='text-align:left;'><select id='SVRid' style='width:212px' name='SVRid'>";
$discovery .= "<option value='Null'>" . _("First Available Server-Distributed") . "</option>";
foreach ($sensor_list as $_sensor_id => $sensor_data) {
if (intval($sensor_data['properties']['has_vuln_scanner']) == 1) {
$discovery .= "<option value=\"{$_sensor_id}\" ";
if ($editdata['email'] == $_sensor_id || $editdata['scan_ASSIGNED'] == $_sensor_id) {
$discovery .= " SELECTED";
}
if ($SVRid_selected == $_sensor_id) {
$discovery .= " SELECTED";
}
$discovery .= ">" . strtoupper($sensor_data['name']) . " [" . $sensor_data['ip'] . "] </option>";
}
}
$discovery .= <<<EOT
</select>
</td>
</tr>
<tr>
EOT;
$discovery .= "<td class='job_option'>" . Util::strong(_("Profile") . ":") . "</td>";
$discovery .= "<td style='text-align:left;'><select name='sid'>";
$query = "";
if ($username == "admin" || Session::am_i_admin()) {
$query = "SELECT distinct(t1.id), t1.name, t1.description \n FROM vuln_nessus_settings t1 WHERE deleted='0'\n ORDER BY t1.name";
} else {
if (Session::is_pro()) {
$users_and_entities = Acl::get_entities_to_assign($dbconn);
if (Acl::am_i_proadmin()) {
$users = Acl::get_my_users($dbconn, Session::get_session_user());
foreach ($users as $us) {
$users_and_entities[$us->get_login()] = $us->get_login();
}
$owner_list['0'] = '0';
$owner_list = array_keys($users_and_entities);
$owner_list = implode("','", $owner_list);
$query = "SELECT distinct(t1.id), t1.name, t1.description FROM vuln_nessus_settings t1\n WHERE deleted = '0' and (name='Default' or owner in ('" . $owner_list . "')) ORDER BY t1.name";
} else {
$owner_list['0'] = '0';
$owner_list[$username] = $username;
$owner_list = array_keys($users_and_entities);
$owner_list[] = Session::get_session_user();
$owner_list = implode("','", $owner_list);
$user_where = "owner in ('" . $owner_list . "')";
$query = "SELECT distinct(t1.id), t1.name, t1.description FROM vuln_nessus_settings t1\n WHERE deleted = '0' and (name='Default' or {$user_where}) ORDER BY t1.name";
}
} else {
$query = "SELECT distinct(t1.id), t1.name, t1.description FROM vuln_nessus_settings t1\n WHERE deleted = '0' and (name='Default' or owner in ('0','{$username}')) ORDER BY t1.name";
}
}
$dbconn->SetFetchMode(ADODB_FETCH_BOTH);
$result = $dbconn->execute($query);
$job_profiles = array();
$id_found = false;
$ipr = 0;
while (!$result->EOF) {
list($sid, $sname, $sdescription) = $result->fields;
if ($sid_selected == $sid) {
$id_found = true;
}
$job_profiles[$ipr]["sid"] = $sid;
示例15: _
?>
</option>
<?php
}
?>
</select>
</td></tr>
<tr><td class="nobborder">
<select name="entity">
<option value="">- <?php
echo _("All Entities");
?>
-</option>
<?php
foreach ($entities_all as $entity) {
if (Session::am_i_admin() || Acl::am_i_proadmin() && in_array($entity["id"], $entities_list)) {
?>
<option value="<?php
echo $entity["id"];
?>
"><?php
echo $entity["name"];
?>
</option>
<?php
}
}
?>
</select>
</td></tr>
<?php