changeset 8:121a3bfd3424

Minor cleanups.
author ccr@tnsp.org
date Thu, 30 Dec 2010 18:09:53 +0200
parents 05d3c0c88f69
children 71631fc7afad
files index.php
diffstat 1 files changed, 17 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/index.php	Thu Dec 30 13:33:22 2010 +0200
+++ b/index.php	Thu Dec 30 18:09:53 2010 +0200
@@ -157,8 +157,8 @@
 function find_pairs($item,$key)
 {
   global $minerals,$herbs,$organs,$db;
-  print"\n";
-  for ($i=0;$i<=count($item);$i++) 
+
+  for ($i=0;$i<count($item);$i++) 
   {
     $min[$item[$i][0]]++;
     $org[$item[$i][1]]++;
@@ -218,7 +218,6 @@
 }
 
 if (filemtime("herb.txt") > filemtime("cache.php"))
-#if (1)
 {
 $file = fopen("herb.txt", "r");
 while (($line = fgets($file)) !== FALSE) {
@@ -232,20 +231,21 @@
  $hn = $hn[0];
 
  if ($r=="-") {
-   $res = "nothing";
    for ($x=1;$x<55;$x++)
      if ($db[$x][$on][$hn][0]!="!")
        $db[$x][$on][$hn][0]="-";
+
    for ($y=1;$y<24;$y++)
      if ($db[$mn][$y][$hn][0]!="!")
        $db[$mn][$y][$hn][0]="-";
+
    for ($z=1;$z<31;$z++)
      if ($db[$mn][$on][$z][0]!="!")
        $db[$mn][$on][$z][0]="-";
+
    $db[$mn][$on][$hn][1]="-";
  }
  if ($r[0]=="?") {
-   $res = "possible $r";
    if ($r[1]!="?")
      $mat[$r][]=array($mn,$on,$hn);
    if ($db[$mn][$on][$hn][0]=="-")
@@ -259,24 +259,13 @@
    }
  }
  if ($r[0]=="!") {
-   $res="accepted $r";
    $t=$r;$t[0]="?";
    $mat[$t][]=array(255,255,255);
-/*   for ($x=0;$x<54;$x++)
-     if ($db[$x][$on][$hn][1]=="")
-     $db[$x][$on][$hn][1]="*";
-   for ($y=0;$y<23;$y++)
-     if ($db[$mn][$y][$hn][1]=="")
-     $db[$mn][$y][$hn][1]="*";
-   for ($z=0;$z<30;$z++)
-     if ($db[$mn][$on][$z][1]=="")
-     $db[$mn][$on][$z][1]="*";
-*/
    $db[$mn][$on][$hn]=$r;
  }
 }
 
-array_walk($mat,'find_pairs');
+array_walk($mat, "find_pairs");
 
 
 
@@ -354,7 +343,7 @@
   echo "</tr></table>\n";
 
   $z=$active_herb;
-  echo ("<h3>". $herbs[$z][0] ." or ". $herbs[$z][1] ."</h3>");
+  echo ("<h1>". $herbs[$z][0] ." or ". $herbs[$z][1] ."</h1>");
   echo ("<table border=1 cellspacing=0><tr><td></td>\n");
   for ($x=1;$x<55;$x++) {
     echo ("<th><img src=\"kuva.php?text=". $minerals[$x] ."\" alt=\"". $minerals[$x] ."\" width=12 height=80></th>");
@@ -365,7 +354,7 @@
     for ($x=1;$x<55;$x++) {
       $r=$db[$x][$y][$z][0];
       $class="";
-      if ($r=="!") $class="class=\"accept\"";
+      if ($r=="!") $class="class=\"accepted\"";
       if ($r=="?") {
         $class="class=\"close\"";
         if ($db[$x][$y][$z][1]=="*") $class="class=\"pairclose\"";
@@ -373,7 +362,7 @@
       if ($r=="-") {
         $class="class=\"nomark\"";
         if ($db[$x][$y][$z][1]!=="") $class="class=\"noclose\"";
-        if ($db[$x][$y][$z][1]=="-") $class="class=\"no\"";
+        if ($db[$x][$y][$z][1]=="-") $class="class=\"nomatch\"";
         if ($db[$x][$y][$z][1]=="*") $class="class=\"pairno\"";
       }
       if ($r==".") {
@@ -423,7 +412,7 @@
   }
   echo "</tr></table>\n";
   $z=$active_min;
-  echo ("<h3>". $minerals[$z] ."</h3>\n");
+  echo ("<h1>". $minerals[$z] ."</h1>\n");
   echo ("<table border=1 cellspacing=0><tr><td></td>");
   for ($x=1;$x<24;$x++) {
     echo ("<th><img src=\"kuva.php?text=". $organs[$x] ."\" alt=\"". $organs[$x] ."\" width=12 height=80></th>");
@@ -434,7 +423,7 @@
     for ($x=1;$x<24;$x++) {
       $r=$db[$z][$x][$y][0];
       $class="";
-      if ($r=="!") $class="class=\"accept\"";
+      if ($r=="!") $class="class=\"accepted\"";
       if ($r=="?") {
         $class="class=\"close\"";
         if ($db[$z][$x][$y][1]=="*") $class="class=\"pairclose\"";
@@ -442,7 +431,7 @@
       if ($r=="-") {
         $class="class=\"nomark\"";
         if ($db[$z][$x][$y][1]!=="") $class="class=\"noclose\"";
-        if ($db[$z][$x][$y][1]=="-") $class="class=\"no\"";
+        if ($db[$z][$x][$y][1]=="-") $class="class=\"nomatch\"";
         if ($db[$z][$x][$y][1]=="*") $class="class=\"pairno\"";
       }
       if ($r==".") {
@@ -486,7 +475,7 @@
   echo "</tr></table>";
 
   $z=$active_org;
-  echo ("<h3>". $organs[$z] ."</h3>");
+  echo ("<h1>". $organs[$z] ."</h1>");
   echo ("<table border=1 cellspacing=0><tr><td></td>");
   for ($x=1;$x<55;$x++) {
     echo ("<th><img src=\"kuva.php?text=". $minerals[$x] ."\" alt=\"". $minerals[$x] ."\" width=12 height=80></th>");
@@ -497,7 +486,7 @@
     for ($x=1;$x<55;$x++) {
       $r=$db[$x][$z][$y][0];
       $class="";
-      if ($r=="!") $class="class=\"accept\"";
+      if ($r=="!") $class="class=\"accepted\"";
       if ($r=="?") {
         $class="class=\"close\"";
         if ($db[$x][$z][$y][1]=="*") $class="class=\"pairclose\"";
@@ -505,7 +494,7 @@
       if ($r=="-") {
         $class="class=\"nomark\"";
         if ($db[$x][$z][$y][1]!=="") $class="class=\"noclose\"";
-        if ($db[$x][$z][$y][1]=="-") $class="class=\"no\"";
+        if ($db[$x][$z][$y][1]=="-") $class="class=\"nomatch\"";
         if ($db[$x][$z][$y][1]=="*") $class="class=\"pairno\"";
       }
       if ($r==".") {
@@ -532,11 +521,11 @@
 <table border="1" cellspacing="1">
  <tr><th colspan="2" class="noframe">Legend</th></tr>
  <tr><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td><th class="noframe">Not researched yet</th></tr>
- <tr><td class="no">-</td><th class="noframe">No match</th></tr>
+ <tr><td class="nomatch">-</td><th class="noframe">No match</th></tr>
  <tr><td class="nomark">-</td><th class="noframe">Marked to no potion by another no match.</th></tr>
  <tr><td class="noclose">-</td><th class="noframe">2 materials match, marked as no potion by another no match.</th></tr>
  <tr><td class="close">?</td><th class="noframe">2 materials match</th></tr>
- <tr><td class="accept">!</td><th class="noframe">Accepted potion</th></tr>
+ <tr><td class="acceptex">!</td><th class="noframe">Accepted potion</th></tr>
  <tr><td class="pair">&nbsp</td><th class="noframe">Known to be possible potion by other attempts</th></tr>
 </table>
 <?php