<commit_before><?xml version="1.0" encoding="UTF-8"?>
<%@ taglib uri="/WEB-INF/jspwiki.tld" prefix="wiki" %>
<%@ page import="com.ecyrd.jspwiki.*" %>
<%@ page import="com.ecyrd.jspwiki.auth.AuthenticationManager" %>
<%@ page import="com.ecyrd.jspwiki.ui.Installer" %>
<%@ page import="org.apache.log4j.*" %>

<%!
    public void jspInit()
    {
        wiki = WikiEngine.getInstance( getServletConfig() );
    }
    Logger log = Logger.getLogger("JSPWiki"); 
    WikiEngine wiki;
%>

<%
// Create wiki context and check for authorization
WikiContext wikiContext = wiki.createContext( request, WikiContext.INSTALL );
if(!wikiContext.hasAccess( response )) return;

Installer installer = new Installer( request, config );
WikiSession wikiSession = wikiContext.getWikiSession();

// Parse the existing properties
installer.parseProperties();
boolean validated = false;
String password = null;

// If user hit "submit" button, validate and install them
if( request.getParameter("submit") != null )
{
    validated = installer.validateProperties();
    if ( validated )
    {
        installer.saveProperties();
        password = installer.createAdministrator();
        if ( password != null )
        {
            wikiSession.addMessage( Installer.INSTALL_INFO, "Because no administrator account "
              + "exists yet, JSPWiki created one for you, with a random password. You can change "
              + "this password later, of course. The account's id is <strong>" + Installer.ADMIN_ID
              + "</strong> and the password is <strong>" + password + "</strong>. "
              + "<em>Please write this information down and keep it in a safe place</em>. "
              + "JSPWiki also created a wiki group called <strong>" + Installer.ADMIN_GROUP
              + "</strong> that contains this user." );
       }
    }
}

if ( !installer.adminExists() )
{
    wikiSession.addMessage( Installer.INSTALL_WARNING, "Is this the first time you've run the "
        + " Installer? If it is, you should know that after JSPWiki validates and saves your " 
        + "configuration for the first time, you will need administrative privileges to access "
        + "this page again. We do this to prevent random people on the Internet from doing bad "
        + "things to your wiki." );
}

    // Make this HTTP response non-cached, and never-expiring
    response.addHeader("Pragma", "no-cache");
    response.setHeader( "Expires", "-1" );
    response.setHeader("Cache-Control", "no-cache" );
    response.setContentType("text/html; charset=UTF-8");
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
  <title>JSPWiki Installer</title>
  <link rel="stylesheet" media="screen, projection" type="text/css" href="<wiki:Link format="url" templatefile="jspwiki.css"/>"/>
  <wiki:IncludeResources type="stylesheet"/>
</head>
<body class="view">
<div id="wikibody">
<div id="page">
<div id="pagecontent">

<h1>JSPWiki Installer</h1>

<p>Welcome!  This little JSP page is here to help you do the first difficult stage of JSPWiki
installation.  If you're seeing this page, you have already installed JSPWiki correctly
inside your container.</p>

<p>There are now some things that you should configure.  When you press submit, the
<code>jspwiki.properties</code> file from the distribution will be modified, or if it 
can't be found, a new one will be created.</p>

<p>This setup system is really meant for people who just want to be up and running really quickly.
If you want to integrate JSPWiki with an existing system, I would recommend that you go and edit
the <code>jspwiki.properties</code> file directly.  You can find a sample config file from 
<code>yourwiki/WEB-INF/</code>.</p>

<!-- Any messages or errors? -->
<div class="instructions">
  <wiki:Messages div="information" topic="<%=Installer.INSTALL_INFO%>" prefix="Good news:"/>
  <wiki:Messages div="warning" topic="<%=Installer.INSTALL_WARNING%>" prefix="Warning: "/>
  <wiki:Messages div="error" topic="<%=Installer.INSTALL_ERROR%>" prefix="Could not save configuration: "/>
</div>
 
<div class="formcontainer">

<form action="Install.jsp" method="post">

  <!-- Page and log directories -->
  <h3>Basics</h3>
  <div class="block">
  
    <label>Application Name</label>
    <input type="text" name="<%=Installer.APP_NAME%>" size="20" value="<%=installer.getProperty( Installer.APP_NAME )%>"/><br />
    <div class="description">
      What should your wiki be called?  Try and make this a relatively short name.
    </div>
    
    <label>Base URL</label>
    <input type="text" name="<%=Installer.BASE_URL%>" size="40" value="<%=installer.getProperty( Installer.BASE_URL )%>"/><br />
    <div class="description">
      Please tell JSPWiki where your wiki is located.
    </div>
    
    <label>Page storage</label>
    <input type="text" name="<%=Installer.PAGE_DIR%>" size="40" value="<%=installer.getProperty( Installer.PAGE_DIR )%>"/><br />
    <div class="description">
      By default, JSPWiki will use the VersioningFileProvider that stores files in a particular
      directory on your hard drive. If you specify a directory that does not exist, JSPWiki will
      create one for you. All attachments will also be put in the same directory.
    </div>
    
  </div>
  
  <h3>Security</h3>
  <div class="block">
  
    <label>Security configuration</label>
    <input type="radio" name="<%=AuthenticationManager.PROP_SECURITY%>" value="<%=AuthenticationManager.SECURITY_JAAS%>" checked="checked"/>
      JAAS plus container security (default)<br/>
    <input type="radio" name="<%=AuthenticationManager.PROP_SECURITY%>" value="<%=AuthenticationManager.SECURITY_CONTAINER%>"/>
      Container security only
   <div class="description">
     By default, JSPWiki manages access to resources using a JAAS-based security system. 
     It will also respect any container security constraints you might have,
     if you've enabled them in your <code>web.xml</code> file. If you disable JAAS security,
     JSPWiki might not work as you expect. But sometimes you might want to do this if you're
     trying to troubleshoot.
   </div>
  
    <% 
      if( validated )
      {
        if ( password != null )
        {
    %>
      <label>Administrator account</label>
      <p>Enabled</p><commit_msg>Changed CONTAINER security to OFF<commit_after><?xml version="1.0" encoding="UTF-8"?>
<%@ taglib uri="/WEB-INF/jspwiki.tld" prefix="wiki" %>
<%@ page import="com.ecyrd.jspwiki.*" %>
<%@ page import="com.ecyrd.jspwiki.auth.AuthenticationManager" %>
<%@ page import="com.ecyrd.jspwiki.ui.Installer" %>
<%@ page import="org.apache.log4j.*" %>

<%!
    public void jspInit()
    {
        wiki = WikiEngine.getInstance( getServletConfig() );
    }
    Logger log = Logger.getLogger("JSPWiki"); 
    WikiEngine wiki;
%>

<%
// Create wiki context and check for authorization
WikiContext wikiContext = wiki.createContext( request, WikiContext.INSTALL );
if(!wikiContext.hasAccess( response )) return;

Installer installer = new Installer( request, config );
WikiSession wikiSession = wikiContext.getWikiSession();

// Parse the existing properties
installer.parseProperties();
boolean validated = false;
String password = null;

// If user hit "submit" button, validate and install them
if( request.getParameter("submit") != null )
{
    validated = installer.validateProperties();
    if ( validated )
    {
        installer.saveProperties();
        password = installer.createAdministrator();
        if ( password != null )
        {
            wikiSession.addMessage( Installer.INSTALL_INFO, "Because no administrator account "
              + "exists yet, JSPWiki created one for you, with a random password. You can change "
              + "this password later, of course. The account's id is <strong>" + Installer.ADMIN_ID
              + "</strong> and the password is <strong>" + password + "</strong>. "
              + "<em>Please write this information down and keep it in a safe place</em>. "
              + "JSPWiki also created a wiki group called <strong>" + Installer.ADMIN_GROUP
              + "</strong> that contains this user." );
       }
    }
}

if ( !installer.adminExists() )
{
    wikiSession.addMessage( Installer.INSTALL_WARNING, "Is this the first time you've run the "
        + " Installer? If it is, you should know that after JSPWiki validates and saves your " 
        + "configuration for the first time, you will need administrative privileges to access "
        + "this page again. We do this to prevent random people on the Internet from doing bad "
        + "things to your wiki." );
}

    // Make this HTTP response non-cached, and never-expiring
    response.addHeader("Pragma", "no-cache");
    response.setHeader( "Expires", "-1" );
    response.setHeader("Cache-Control", "no-cache" );
    response.setContentType("text/html; charset=UTF-8");
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
  <title>JSPWiki Installer</title>
  <link rel="stylesheet" media="screen, projection" type="text/css" href="<wiki:Link format="url" templatefile="jspwiki.css"/>"/>
  <wiki:IncludeResources type="stylesheet"/>
</head>
<body class="view">
<div id="wikibody">
<div id="page">
<div id="pagecontent">

<h1>JSPWiki Installer</h1>

<p>Welcome!  This little JSP page is here to help you do the first difficult stage of JSPWiki
installation.  If you're seeing this page, you have already installed JSPWiki correctly
inside your container.</p>

<p>There are now some things that you should configure.  When you press submit, the
<code>jspwiki.properties</code> file from the distribution will be modified, or if it 
can't be found, a new one will be created.</p>

<p>This setup system is really meant for people who just want to be up and running really quickly.
If you want to integrate JSPWiki with an existing system, I would recommend that you go and edit
the <code>jspwiki.properties</code> file directly.  You can find a sample config file from 
<code>yourwiki/WEB-INF/</code>.</p>

<!-- Any messages or errors? -->
<div class="instructions">
  <wiki:Messages div="information" topic="<%=Installer.INSTALL_INFO%>" prefix="Good news:"/>
  <wiki:Messages div="warning" topic="<%=Installer.INSTALL_WARNING%>" prefix="Warning: "/>
  <wiki:Messages div="error" topic="<%=Installer.INSTALL_ERROR%>" prefix="Could not save configuration: "/>
</div>
 
<div class="formcontainer">

<form action="Install.jsp" method="post">

  <!-- Page and log directories -->
  <h3>Basics</h3>
  <div class="block">
  
    <label>Application Name</label>
    <input type="text" name="<%=Installer.APP_NAME%>" size="20" value="<%=installer.getProperty( Installer.APP_NAME )%>"/><br />
    <div class="description">
      What should your wiki be called?  Try and make this a relatively short name.
    </div>
    
    <label>Base URL</label>
    <input type="text" name="<%=Installer.BASE_URL%>" size="40" value="<%=installer.getProperty( Installer.BASE_URL )%>"/><br />
    <div class="description">
      Please tell JSPWiki where your wiki is located.
    </div>
    
    <label>Page storage</label>
    <input type="text" name="<%=Installer.PAGE_DIR%>" size="40" value="<%=installer.getProperty( Installer.PAGE_DIR )%>"/><br />
    <div class="description">
      By default, JSPWiki will use the VersioningFileProvider that stores files in a particular
      directory on your hard drive. If you specify a directory that does not exist, JSPWiki will
      create one for you. All attachments will also be put in the same directory.
    </div>
    
  </div>
  
  <h3>Security</h3>
  <div class="block">
  
    <label>Security configuration</label>
    <input type="radio" name="<%=AuthenticationManager.PROP_SECURITY%>" value="<%=AuthenticationManager.SECURITY_JAAS%>" checked="checked"/>
      JAAS plus container security (default)<br/>
    <input type="radio" name="<%=AuthenticationManager.PROP_SECURITY%>" value="<%=AuthenticationManager.SECURITY_OFF%>"/>
      Container security only
   <div class="description">
     By default, JSPWiki manages access to resources using a JAAS-based security system. 
     It will also respect any container security constraints you might have,
     if you've enabled them in your <code>web.xml</code> file. If you disable JAAS security,
     JSPWiki might not work as you expect. But sometimes you might want to do this if you're
     trying to troubleshoot.
   </div>
  
    <% 
      if( validated )
      {
        if ( password != null )
        {
    %>
      <label>Administrator account</label>
      <p>Enabled</p>
{'fraction_non_alphanumeric': 0.13285175879396985, 'fraction_numerical': 0.0037688442211055275, 'mean_word_length': 3.667277390985709, 'pattern_counts': {'":': 0, '<': 211, '<?xml version=': 2, '>': 211, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '777774', 'n_tokens_mistral': 3918, 'n_tokens_neox': 3723, 'n_words': 1193}