Class DocTools

java.lang.Object
sk.iway.iwcm.common.DocTools

public class DocTools extends Object
  • Constructor Details

    • DocTools

      protected DocTools()
  • Method Details

    • isXssStrictUrlException

      public static boolean isXssStrictUrlException(String path, String constantName)
      Otestuje, ci zadana cesta je nastavena ako vynimka pre Strict XSS filter
      Parameters:
      path - - URL adresa
      constantName - - meno konstanty, bud xssProtectionStrictGetUrlException, alebo xssProtectionStrictPostUrlException
      Returns:
    • isUrlAllowed

      public static boolean isUrlAllowed(String path, String constantName, boolean appendSystemValue)
      Otestuje, ci zadana cesta je v zozname ciest definovanych v zadanej konstante. Konstanta je definovana ako ciarkou oddeleny zoznam URL adries, ak URL zacina na % pouzije sa substring, ak konci na ! pouzije sa equal, ak URL zacina na % a konci na ! pouzije sa endsWith, inak sa pouzije startsWith
      Parameters:
      path - - URL adresa
      constantName - - meno konstanty so zoznamom povolenych URL adries
      appendSystemValue - - ak je nastavene na true, tak sa hlada v constantName aj v constantNameSystem (zoznam povoleni sa spoji)
      Returns:
    • removeChars

      public static String removeChars(String ret)
      vyhodi nepovolene znaky z nazvu suboru (zrusi aj znak /) POZOR: DA to na LOWER CASE!!!
      Parameters:
      ret - Description of the Parameter
      Returns:
      Description of the Return Value
    • removeChars

      public static String removeChars(String ret, boolean lowerCase)
      Vyhodi nepovolene znaky z nazvu suboru
      Parameters:
      ret -
      lowerCase - - ak je nastavene na true, zmeni aj velkost na male pismena
      Returns:
    • testXss

      public static boolean testXss(String value)
      Otestuje, ci zadana hodnota obsahuje znaky XSS
      Parameters:
      value -
      Returns:
    • removeCharsDir

      public static String removeCharsDir(String ret)
      Vyhodi nepovolene znaky z nazvu adresara (ponecha znak /) POZOR: neda to na LOWER CASE!!!
      Parameters:
      ret - Description of the Parameter
      Returns:
    • removeCharsDir

      public static String removeCharsDir(String ret, boolean removeSpojky)
    • getRequestNameDocId

      public static int getRequestNameDocId(String name, javax.servlet.http.HttpServletRequest request)
      Vrati docId stranky pre request hodnotu doc_data, doc_menu, doc_header atd
      Parameters:
      name -
      request -
      Returns:
    • updateCodes

      public static StringBuilder updateCodes(Identity user, StringBuilder text, int currentDocId, javax.servlet.http.HttpServletRequest request, javax.servlet.ServletContext servletContext)
      aktualizuje kody v texte
      Parameters:
      user -
      text -
      currentDocId -
      request -
      servletContext -
      Returns:
    • updateUserCodes

      public static StringBuilder updateUserCodes(Identity user, StringBuilder text)
      Aktualizuje kody pouzivatela !LOGGED_USER_XXX! v texte
      Parameters:
      user - Description of the Parameter
      text - Description of the Parameter
      Returns:
      Description of the Return Value
    • getXssStrictUrlRedirect

      public static String getXssStrictUrlRedirect(javax.servlet.http.HttpServletRequest request, String path, String qs)
      Strict XSS filter, pouziva sa na KOMPLET VSETKY GET poziadavky (ak je zapnuty), volane z PathFilter
      Parameters:
      request -
      path -
      qs -
      Returns:
    • testXssStrictGet

      public static boolean testXssStrictGet(String value)
      Striktny test na XSS hodnotu, pouziva sa len v pripade GET poziadaviek
      Parameters:
      value -
      Returns:
    • createWebPage

      @Deprecated public static int createWebPage(GroupDetails group, Identity user, javax.servlet.http.HttpServletRequest request, String title)
      Deprecated.
      - use AdminTools.createWebPage
    • getEditableDocs

      public static List<DocDetails> getEditableDocs(int group_id, Identity user, int maxSize)
      Pripravi zoznam editovatelnych stranok pre daneho pouzivatela, maxSize sa pouziva pre specialny pripad obmedzujuci vrateny zoznam
      Parameters:
      group_id -
      user -
      maxSize -
      Returns:
    • getHtmlDiff

      public static String getHtmlDiff(String htmlCodeNew, String htmlCodeOld) throws Exception
      Performs HTML diffing on two HTML strings. Notice that the input strings are "cleaned-up" first (e.g. all html tags are converted to lowercase).
      Parameters:
      htmlCodeNew - - current HTML code
      htmlCodeOld - - old HTML code to compare with
      Returns:
      the result
      Throws:
      Exception - - something went wrong.