Beispiel #1
0
    // users
    $users = array();
    if (Session::am_i_admin()) {
        $users_list = Session::get_list($conn_ossim);
        foreach ($users_list as $user_data) {
            $users[] = $user_data->login;
        }
    } else {
        $users_list = Acl::get_my_users($conn_ossim, Session::get_session_user());
        foreach ($users_list as $user_data) {
            $users[] = $user_data["login"];
        }
    }
    // entities
    list($entities_all, $num_entities) = Acl::get_entities($conn_ossim);
    list($entities_admin, $num) = Acl::get_entities_admin($conn_ossim, Session::get_session_user());
    $entities_list = array_keys($entities_admin);
}
$db->close($conn);
$db->close($conn_ossim);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
	<head>
		<title><?php 
echo _('Backup');
?>
</title>
 		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
  		<meta http-equiv="Pragma" content="no-cache">
  		<link rel="stylesheet" type="text/css" href="../style/style.css"/>
Beispiel #2
0
    function showSubCategoryHTML()
    {
        // get list reports
        $db = new ossim_db();
        $dbconn = $db->connect();
        $creports = array();
        $subreports_ac = array();
        $sql_search = "";
        if ($search != "") {
            $sql_search = "AND name like '%{$search}%'";
        }
        $result = $dbconn->Execute("SELECT login, name, value FROM user_config where category='custom_report' {$sql_search} ORDER BY name ASC");
        $hi = 0;
        while (!$result->EOF) {
            $available = false;
            $unserializedata = unserialize($result->fields["value"]);
            $available_for_user = $unserializedata["user"];
            $available_for_entity = $unserializedata["entity"];
            // check if this report is available for session user
            if (Session::am_i_admin()) {
                $available = true;
            } else {
                if ($available_for_user == "0") {
                    $available = true;
                } else {
                    if ($available_for_user != "" && $available_for_user == $session_user || $result->fields["login"] == $session_user) {
                        $available = true;
                    } else {
                        if (preg_match("/pro|demo/i", $version)) {
                            if (Acl::am_i_proadmin()) {
                                $entities_list = Acl::get_entities_admin($dbconn, Session::get_session_user());
                                $entities = array_keys($entities_list[0]);
                                $users = Acl::get_my_users($dbconn, Session::get_session_user());
                                $users_login = array();
                                foreach ($users as $user) {
                                    $users_login[] = $user["login"];
                                }
                                if (in_array($available_for_entity, $entities) || in_array($available_for_user, $users_login) || in_array($result->fields["login"], $users_login)) {
                                    $available = true;
                                }
                            } else {
                                $entities = Acl::get_user_entities(Session::get_session_user());
                                if (in_array($available_for_entity, $entities)) {
                                    $available = true;
                                }
                            }
                        }
                    }
                }
            }
            // save report if is available
            $maxpag = 20;
            $to = $pag * $maxpag;
            $from = $to - $maxpag;
            if ($available) {
                if ($from <= $hi && $hi < $to) {
                    $creports[] = $result->fields;
                }
                // autocomplete
                $key = base64_encode($result->fields["name"] . "###" . $result->fields["login"]);
                $subreports_ac[$key] = trim($result->fields["name"]);
                $hi++;
            }
            $result->MoveNext();
        }
        $dbconn->disconnect();
        //
        $html = '<table style="margin:0;padding:0;width:100%;font-size:11px">
					<tr>
						<td colspan="2">' . _('Properties report') . ':</td>
					</tr>
					<tr>
						<td>' . _('Report Name') . ':</td>
						<td>
							<select name="run">';
        foreach ($subreports_ac as $key => $value) {
            $html .= '<option value="' . $key . '"';
            $html .= $this->get('run') == $key ? ' selected="selected"' : "";
            $html .= '>' . $value . '</option>';
        }
        $html .= ' 		</select>
						</td>
					</tr>
					<tr>
						<td>' . _('Refresh report') . ':</td>
						<td><input name="refresh" value="false" ';
        if ($this->get('refresh') == 'false') {
            $html .= 'checked="checked" ';
        }
        $html .= 'type="radio">' . _('No') . '
					<input name="refresh" value="true" ';
        if ($this->get('refresh') == 'true') {
            $html .= 'checked="checked" ';
        }
        $html .= 'type="radio">' . _('Yes') . '
						<input style="width:80px" type="text" name="secondRefresh" value="' . $this->get('secondRefresh') . '" /> ' . _('seconds') . '</td>
					</tr>
				</table>';
        return $html;
    }