Пример #1
0
 public static Array getTemplateConfigFileList() {
   Array array = new Array();
   String s = Platform.getRoot() + "/groups/" + TEMPLATES_FILE;
   File file = new File(s);
   if (file.exists()) {
     array.add(s);
   }
   if (Platform.isPortal()) {
     Portal.addTemplateConfigFiles(array);
   }
   return array;
 }
Пример #2
0
  public static Vector getTemplateList(String s) {
    Vector vector = new Vector();
    vector.addElement("");
    vector.addElement("none");
    String s1 = Platform.getRoot() + "/groups/" + TEMPLATES_FILE;
    if (s.length() > 0) {
      s = Portal.cleanPortalServerID(s);
      s1 = Portal.getPortalSiteViewRootPath(s) + "/groups/" + TEMPLATES_FILE;
    }
    try {
      Array array = FrameFile.readFromFile(s1);
      for (int i = 1; i < array.size(); i++) {
        HashMap hashmap = (HashMap) array.at(i);
        vector.addElement(TextUtils.getValue(hashmap, "__id"));
        vector.addElement(TextUtils.getValue(hashmap, "__name"));
      }

    } catch (IOException e) {
      /* empty */
    }
    return vector;
  }
Пример #3
0
  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;
  }