public PortalQuery( HashMap hashmap, PortalQueryVisitor portalqueryvisitor, HTTPRequest httprequest) { itemFilter = null; addAlerts = false; findObjects = 7; request = null; config = null; visitor = null; debug = false; visitor = portalqueryvisitor; if (httprequest == null) { request = new HTTPRequest(); request.setUser("administrator"); } else { request = httprequest; } config = MasterConfig.getMasterConfig(); itemFilter = new PortalFilter(hashmap); User user = request.getUser(); PortalFilter portalfilter = new PortalFilter(user.getProperty("_query")); itemFilter.addFilter(portalfilter); if (TextUtils.getValue(hashmap, "serverDepth").length() > 0) { findObjects = 4; } else if (TextUtils.getValue(hashmap, "groupDepth").length() > 0) { findObjects = 6; } if (TextUtils.getValue(hashmap, "trace").length() > 0) { debug = true; } portalqueryvisitor.initialize(hashmap, this); }
public Vector getScalarValues(ScalarProperty scalarproperty, HTTPRequest httprequest, CGI cgi) throws SiteViewException { if (scalarproperty == pScript) { Vector vector = getScriptList(getProperty(pMachineName), getProperty(pLocalScriptLocation), httprequest); vector.addElement("USE COMMAND"); vector.addElement("USE COMMAND"); return vector; } if (scalarproperty == pRemoteScript) { Vector vector1 = new Vector(); File file = new File(Platform.getUsedDirectoryPath("scripts.remote", httprequest.getAccount())); String as[] = file.list(); if (as != null) { vector1.addElement("none"); vector1.addElement("none"); for (int i = 0; i < as.length; i++) { String s = I18N.toNullEncoding(as[i]); if (Platform.isUnix() && s.startsWith(".")) { continue; } File file1 = new File(file, as[i]); if (!file1.isDirectory()) { vector1.addElement(s); vector1.addElement(s); } } } return vector1; } else { return super.getScalarValues(scalarproperty, httprequest, cgi); } }
public static String getViewContent(String s, HTTPRequest httprequest) { String s1 = ""; String s2 = Platform.getUsedDirectoryPath("templates.view", httprequest.getAccount()) + File.separator + s; try { s1 = FileUtils.readFile(s2).toString(); s1 = TextUtils.replaceString( s1, "account=administrator", "account=" + httprequest.getAccount()); s1 = TextUtils.replaceString( s1, "name=\"account\" value=\"administrator\"", "name=\"account\" value=\"" + httprequest.getAccount() + "\""); } catch (IOException ioexception) { LogManager.log("Error", "Could not read view file " + s2); } return s1; }
public String verify( StringProperty stringproperty, String s, HTTPRequest httprequest, HashMap hashmap) { if (stringproperty == getPropertyObject(PROPERTY_NAME_BROWSABLE)) { String s1 = getProperty(PROPERTY_NAME_COUNTER_ID + 1); if (s1.length() <= 0) { String s2 = httprequest.getValue("browseDataError"); if (s2 != null && s2.length() > 0) { hashmap.put(stringproperty, s2); } else { hashmap.put(stringproperty, "No counters selected"); } } return s; } else { return super.verify(stringproperty, s, httprequest, hashmap); } }
public String verify( StringProperty stringproperty, String s, HTTPRequest httprequest, HashMap hashmap) { if (stringproperty == pFrequency) { HashMap hashmap1 = MasterConfig.getMasterConfig(); int i = TextUtils.toInt(TextUtils.getValue(hashmap1, "_J2EEReportMonitorMinRefreshTime")); if (i < 15) { i = 300; } String s1 = httprequest.getValue(stringproperty.getName() + "Units"); int j = FrequencyProperty.toSeconds(TextUtils.toInt(s), s1); if (j < i && j != 0) { hashmap.put(stringproperty, j + " was less than " + i + " seconds"); } return Integer.toString(j); } else { return super.verify(stringproperty, s, httprequest, hashmap); } }
public String getReturnURL() { return HTTPRequest.encodeString(returnURL); }
public static Vector getScriptList(String s, String s1, HTTPRequest httprequest) { Vector vector = new Vector(); String s2 = s1; if (s2 == null || s2.length() == 0) { s2 = "scripts"; } s = Machine.getFullMachineID(s, httprequest); if (Machine.isPortalMachineID(s)) { String s3 = Machine.getServerIDFromMachineID(s); PortalSiteView portalsiteview = (PortalSiteView) Portal.getPortal().getElement(s3); if (portalsiteview != null) { String s4 = "/SiteView/cgi/go.exe/SiteView?page=remoteOp&operation=scripts&machineID=" + Machine.getMachineFromMachineID(s) + "&account=administrator"; ArrayList array2 = portalsiteview.sendURLToRemoteSiteView(s4, null); for (int i1 = 0; i1 < array2.size(); i1++) { vector.addElement(array2.get(i1)); } } else { LogManager.log("Error", "Could not find SiteView ID: " + s3); } } else if (Machine.isNTSSH(s)) { RemoteFile remotefile = new RemoteFile(s, "scripts"); ArrayList array = remotefile.listFiles(); for (int j = 0; j < array.size(); j++) { String s5 = I18N.toNullEncoding((String) array.get(j)); if (!s5.endsWith(".txt") && !s5.endsWith("directory.bat") && (s5.endsWith(".bat") || s5.endsWith(".vbs") || s5.endsWith(".exe") || s5.endsWith(".pl") || s5.endsWith(".sh"))) { String as1[] = TextUtils.split(s5, " "); s5 = as1[as1.length - 1].trim(); vector.addElement(s5); vector.addElement(s5); } } } else if (Platform.isCommandLineRemote(s)) { RemoteFile remotefile1 = new RemoteFile(s, "scripts"); int i = Machine.getOS(s); ArrayList array1 = remotefile1.listFiles(); for (int l = 0; l < array1.size(); l++) { String s7 = I18N.toNullEncoding((String) array1.get(l)); if (!s7.endsWith(".txt") && (!Platform.isUnix(i) || !s7.startsWith("."))) { vector.addElement(s7); vector.addElement(s7); } } } else { File file = new File(Platform.getUsedDirectoryPath(s2, httprequest.getAccount())); String as[] = file.list(); for (int k = 0; k < as.length; k++) { String s6 = I18N.toNullEncoding(as[k]); if (s6.endsWith(".txt") || Platform.isUnix() && s6.startsWith(".")) { continue; } File file1 = new File(file, as[k]); if (!file1.isDirectory()) { vector.addElement(s6); vector.addElement(s6); } } } return vector; }