<!--%%INCLUDE "i_defaulthead.incl"-->
   <title>PolluStop Database</title>
</head>
<body>
   <h1>PolluStop Database<br />
   <span class="h2">%%domainname%%</span></h1>
   <!--%%INCLUDE "i_statuscodes.incl"-->
   <form action="database" method="post" enctype="multipart/form-data">

   <fieldset>
      <legend>Database Status</legend><ul><!--%%IF database.iscasesensitive-->
      <li>The database contains mixed-case tokens</li><!--%%ELSE-->
      <li>The database contains only lower-case tokens</li><!--%%ENDIF--><!--%%IF zzz--><!--% %IF database.haschainedtokens-->
      <li>The database contains chained tokens</li><!--% %ELSE-->
      <li>The database doesn't contain chained tokens</li><!--% %ENDIF--><!--%%ENDIF--><!--%%IF database.hascontextualtokens-->
      <li>The database contains contextual tokens</li><!--%%ENDIF--><!--%%IF database.isniversoft-->
      <li>The Spam database has been trained starting with a Niversoft-provided database</li><!--%%ENDIF-->
      <li>The Spam set contains <span class="tt">%%database.spamtokens%%</span> unique tokens from <span class="tt">%%database.spammessages%%</span> messages (approx <span class="tt">%%database.spamtokpermsg%%</span> / message).</li>
      <li>The Good set contains <span class="tt">%%database.goodtokens%%</span> unique tokens from <span class="tt">%%database.goodmessages%%</span> messages (approx <span class="tt">%%database.goodtokpermsg%%</span> / message).</li>
      <li>The Spam set <!--%%IF NOT(database.spamok)--><span class="bolderrors">does not</span> contain<!--%%ELSE-->contains<!--%%ENDIF--> enough tokens and messages to be considered reliable.</li>
      <li>The Good set <!--%%IF NOT(database.goodok)--><span class="bolderrors">does not</span> contain<!--%%ELSE-->contains<!--%%ENDIF--> enough tokens and messages to be considered reliable.</li><!--%%IF NOT(database.goodunbroke)-->
      <li style="color:red">The Good set uses an old format and doesn't take advantage of all features provided by PolluStop. You should retrain it from scratch to get a better accuracy when searching for spam.</li><!--%%ENDIF--><!--%%IF NOT(database.spamunbroke)-->
      <li style="color:red">The Spam set uses an old format and doesn't take advantage of all features provided by PolluStop. You should retrain it from scratch to get a better accuracy when searching for spam.</li><!--%%ENDIF-->
   </ul></fieldset>

   <!--%%IF adminmode-->
   <fieldset>
      <legend>Database query</legend>
      <p class="explain">Enter one or more (space-separated) words you want to know the score of:</p>
      <p><textarea name="tokens" style="width:100%" cols="80" rows="5"></textarea></p>
      <p><input name="query" class="btn" type="submit" value="Query Database" /></p>

      <!--%%IF EXISTS(results)-->
      <table cellspacing="0">
         <tr><th class="table">Token</th><th class="table" colspan="2">Spam occurences</th><th class="table" colspan=2>Good occurences</th><th  class="table">Score</th></tr><!--%%FORALL result in results-->
         <tr><td class="table">%%result[].token%%</td><td class="table1">%%result[].spam%%</td><td class="table2">(%%result[].spamratio%%)</td><td class="table1">%%result[].good%%</td><td class="table2">(%%result[].goodratio%%)</td><td class="table">%%result[].score%%</td></tr>
      <!--%%ENDFOR result--></table>
      <!--%%ENDIF-->
   </fieldset>

   <fieldset><legend>Database operations</legend>
      <fieldset><legend>Create manual backup</legend>
         <p class="explain">A backup of the database is automatically created each time the database is saved after modification. Previous backups are kept for the time specified in the <a href="/general#backup">Backup Files</a> section of the <a href="/general">General Settings</a> page. You can create a manual backup of the database which will not be automatically deleted.</p>
         <p><input class="btn" type="submit" name="createbackup" value="Create manual backup" /></p>
      </fieldset>

      <fieldset><legend>Restore backup</legend>
         <p class="explain">You can restore a previous backup of the database:</p>
         <p>Good messages: <select style="width:auto;" name="goodbackuptorestore"><!--%%STRINGMENU "*" IN goodbackups--></select></p>
         <p>Spam messages: <select style="width:auto;" name="spambackuptorestore"><!--%%STRINGMENU "*" IN spambackups--></select></p>
         <p><input type="submit" name="restorebackup" class="btn" value="Restore selected backup[s]" /></p>
      </fieldset>

      <fieldset><legend>Delete backup</legend>
         <p class="explain">Automatic backups are automatically deleted after the delay specified in the <a href="/general#backup">Backup Files</a> section of the <a href="/general">General Settings</a> page. Manual backups are not deleted automatically, you can delete them manually.</p>
         <p>Good messages: <select style="width:auto;" name="goodbackuptodelete"><!--%%STRINGMENU "*" IN goodbackups--></select></p>
         <p>Spam messages: <select style="width:auto;" name="spambackuptodelete"><!--%%STRINGMENU "*" IN spambackups--></select></p>
         <p><input type="submit" name="deletebackup" class="btn" value="Delete selected backup[s]" /></p>
      </fieldset>

      <fieldset><legend>Purge database</legend>
         <p class="explain">You can purge the databases to start over with training:</p>
         <p><input disabled="disabled" class="btn" type="submit" name="purgegooddb" value="Purge Good messages DB" /> <input disabled="disabled" class="btn" type="submit" name="purgespamdb" value="Purge Spam messages DB" /></p>
         <p><input onclick="IAmSure(this, 'purgegooddb', 'purgespamdb')" type="checkbox" name="purgedbsure" id="purgedbsure" value="1" /><label for="purgedbsure">I am sure</label></p>
      </fieldset>

      <fieldset><legend>Upload database file</legend>
         <p class="explain">You can upload a database file (.db72 files only) to replace or append to the existing one :</p>
         <p><input type="file" name="newfile" />
            <input type="radio" name="appendfile" id="appendfile0" onclick="IAmSure(this,'uploadgooddb','uploadspamdb')" value="0" /><label for="appendfile0">Replace</label>
            <input type="radio" name="appendfile" id="appendfile1" onclick="IAmSure(this,'uploadgooddb','uploadspamdb')" value="1" /><label for="appendfile1">Append</label></p>
         <p><input type="submit" disabled="disabled" name="uploadgooddb" class="btn" value="Upload new Good DB" />
            <input type="submit" disabled="disabled" name="uploadspamdb" class="btn" value="Upload new Spam DB" /></p>
      </fieldset>

   </fieldset><!--%%ENDIF-->
   </form>
<!--%%INCLUDE "i_defaultfoot.incl"-->
