$self = "lpstore";
include "include/igb.php";
include "include/factions.php";
include "include/itemicon.php";
include "include/filename.php";
$useragent = (isset($_SERVER["HTTP_USER_AGENT"])) ? $_SERVER["HTTP_USER_AGENT"] : "none";
$crawler = (strpos($useragent,"Googlebot") !== FALSE) ? 1 : 0;
$crawler += (strpos($useragent,"Yahoo! Slurp") !== FALSE) ? 1 : 0;
$crawler += (strpos($useragent,"msnbot/") === 0) ? 1 : 0;
if ($igb == FALSE)
{
if ($crawler == 0)
{
?>
}
else echo "\n";
?>
}
echo "
\n";
if ($igb == FALSE)
{
?>
}
echo "This database is outdated by more than a year, so use it with caution
\n";
echo "Post feedback/questions\n";
// start of Block 1
if (isset($_GET["fact"]) || isset($_GET["c"]))
{
$p = 0;
if (isset($_GET["p"]) && is_numeric($_GET["p"])) $p = intval($_GET["p"]);
$sgfx = "";
if (isset($_GET["gfx"])) $sgfx = $_GET["gfx"];
$sgfx = ($sgfx == "true" || $sgfx == "1") ? TRUE : FALSE;
$sfact = "";
if (isset($_GET["fact"])) $xfact = $_GET["fact"];
if (isset($xfact))
{
if ($xfact == "")
$sfact = "any";
else
if ($xfact == "any" || $xfact == "all")
$sfact = $xfact;
else
foreach($faction2long as $short => $long)
{
if (strtolower($xfact) == $short)
$sfact = $short;
}
}
$skey = "";
$scorp = "";
if (isset($_GET["key"])) $xkey = $_GET["key"];
if (isset($xkey))
{
$skey = $xkey;
if (stripos($skey,"corp:") === 0)
{
$scorp = strtolower(substr($skey,5));
}
}
if (isset($_GET["c"])) $xcorp = trim($_GET["c"]);
if (isset($xcorp) && $xcorp)
{
$sfact = "any";
$scorp = strtolower($xcorp);
$skey = "corp:".$xcorp;
}
$smin = "";
if (isset($_GET["min"])) $xmin = $_GET["min"];
if (isset($xmin) && is_numeric($xmin))
{
$smin = intval($xmin);
}
$smax = "";
if (isset($_GET["max"])) $xmax = $_GET["max"];
if (isset($xmax) && is_numeric($xmax))
{
$smax = intval($xmax);
}
$sort = "lpdown";
if (isset($_GET["sort"]))
{
$sort = strtolower($_GET["sort"]);
}
$sfile = $fn_lpdb_sort_lp;
if ($sort == "factdown" || $sort == "factup") $sfile = $fn_lpdb_sort_fact;
if ($sort == "corpdown" || $sort == "corpup") $sfile = $fn_lpdb_sort_corp;
$x = (file_exists($sfile)) ? file_get_contents($sfile) : "0";
$x = intval($x);
$x = ($x) ? ($x+1) : 1;
$f = fopen($sfile,"w");
fwrite($f,$x);
fclose($f);
unset($sfile,$x);
function lpref($text,$extra = "")
{
if ($GLOBALS['crawler']) return($text);
$q = array();
$doc = $GLOBALS["self"];
$q["p"] = $GLOBALS["p"];
$q["min"] = $GLOBALS["smin"];
$q["max"] = $GLOBALS["smax"];
$q["key"] = urlencode($GLOBALS["skey"]);
$q["fact"] = $GLOBALS["sfact"];
$q["gfx"] = $GLOBALS["sgfx"];
$q["sort"] = $GLOBALS["sort"];
if ($extra)
{
$extra = explode("&",$extra);
foreach($extra as $x)
{
if (strpos($x,"=") !== FALSE)
{
list($a,$b) = explode("=",$x);
$q[$a] = $b;
}
else
{
$doc = $x;
}
}
}
$args = "";
foreach($q as $a => $b)
{
if ($a == "fact" && $b == "any")
{
$args .= "&fact=";
}
else
if ($a && $b)
{
$args .= "&".$a."=".$b;
}
}
if (strpos($args,'&') === 0)
$args = substr($args,1);
$args = str_replace('&','&',$args);
$url = "$text";
$url = str_replace('?"','"',$url);
return($url);
}
$factionselect = ""
.''
.'';
foreach($faction2long as $short => $long)
{
if ($short == $sfact) $factionselect .= "";
else $factionselect .= "";
}
if ($igb == FALSE)
{
?>Entry Quality: Bad - - Good To report an incorrect entry to the editors,
press the colored square to the right in the item line.
}
$f1 = ($igb) ? "#7e7868" : "#eee8d8";
$f2 = ($sgfx) ? " checked" : "";
$f3 = lpref("LP",($sort == "lpdown")?"sort=lpup":"sort=lpdown");
$f4 = lpref("Corporation",($sort == "corpdown")?"sort=corpup":"sort=corpdown");
$f5 = lpref("Faction",($sort == "factdown")?"sort=factup":"sort=factdown");
if ($crawler == 0)
{
?>
|
| Item | Required Items | |
| | Date |
}
else
{
?>
| LP |
| Item | Required Items | Corporation |
Faction | | Date |
}
unset($f1,$f2,$fsel,$anysel,$allsel);
$dbf = $fn_lpdb_sorted_lpdown;
if ($sort == "factdown") $dbf = $fn_lpdb_sorted_factdown;
if ($sort == "factup") $dbf = $fn_lpdb_sorted_factup;
if ($sort == "corpdown") $dbf = $fn_lpdb_sorted_corpdown;
if ($sort == "corpup") $dbf = $fn_lpdb_sorted_corpup;
if ($sort == "lpdown") $dbf = $fn_lpdb_sorted_lpdown;
if ($sort == "lpup") $dbf = $fn_lpdb_sorted_lpup;
$db = (file_exists($dbf)) ? file_get_contents($dbf) : "";
$db = explode("\n",$db);
unset($dbf);
// load the quality database
$qualitydb = array();
if (file_exists($fn_lpdb_qualitydb))
{
$qdb = file_get_contents($fn_lpdb_qualitydb);
$qdb = str_replace("\r","",$qdb);
$qdb = explode("\n",$qdb);
foreach($qdb as $line) if ($line)
{
list($lineid,$q,$res) = explode(":",$line.":::");
$qualitydb[$lineid] = intval($q);
}
}
$disp = array();
$pagelimit = ($igb) ? 10 : 40;
$pct = ($p * $pagelimit) + $pagelimit;
$showct = 0;
$linect = 0;
foreach($db as $line) if ($line)
{
$linect++;
list($lp,$isk,$realitem,$fact,$corp,$cost,$ts) = explode(chr(1),$line,7);
$show = TRUE;
if ($sfact != "any" && $sfact != $fact && $fact != "all") $show = FALSE;
if ($scorp)
{
if ($scorp != strtolower($corp) && strtolower($corp) != "all") $show = FALSE;
}
else
if ($skey)
{
$k = explode(" ",$skey);
$kshow = 0;
foreach($k as $word)
{
if (stripos($line,$word) !== FALSE)
$kshow++;
}
if (count($k) > $kshow)
$show = FALSE;
}
if ($smin > 0 && $smin > $lp) $show = FALSE;
if ($smax > 0 && $smax < $lp) $show = FALSE;
if ($show == TRUE)
{
$infolink = FALSE;
if (strpos($realitem,"Hardwiring") === 0)
{
$infolink = TRUE;
}
if ((time() - intval($ts)) < 900000000)
{
if (is_numeric($ts) == FALSE)
{
file_put_contents("debug_numeric",$line."\n",FILE_APPEND);
}
$date = gmdate("M j",intval($ts));
}
$fact = strtolower($fact);
$flong = ucfirst($fact);
if (isset($faction2long[$fact])) $flong = $faction2long[$fact];
$n = substr($realitem,0,strpos($realitem," "));
$n = str_replace("x","",$n);
if (is_numeric($n))
{
$item = substr($realitem,2+strlen($n));
$itembox = $item." (".$n.")";
}
else
{
$itembox = $item = $realitem;
}
/* find the quality if its lower than default */
$crc = crc32($line);
$lineid = "ts=".$ts."&crc=".$crc;
if ($igb || $crawler) $qualityimg = "";
else
{
$q = (isset($qualitydb[$lineid])) ? $qualitydb[$lineid] : 7;
$qualityimg = "";
}
$icon = "";
if ($sgfx == TRUE)
{
$iconstyle = ($igb) ? "" : " style=\"border-bottom:2px solid #ffe;\"";
if (isset($itemicon[$item]))
{
$icon = "
";
}
else
{
$icon = "";
foreach($groupicon as $ga => $gb)
{
if (strpos($item,$ga) !== FALSE)
{
$icon = "
";
break;
}
}
}
}
$lp = number_format($lp,0,'.',',');
$iskf = number_format($isk,0,'.',',');
$cc = ($isk > 0) ? "$iskf ISK" : "";
$costbox = $cc;
$i0class = "";
if (!empty($cost))
{
$xs = (strpos($cost,"
") !== FALSE) ? "s" : "";
$x = explode("
",$cost);
$n = count($x);
$x = join("
",$x);
$cc = ($isk > 0) ? "$iskf ISK
" : "";
if ($igb)
{
$costbox = $cc.$x;
}
else
{
$i0class = " class=i0";
$costbox = "$n item$xs".$cc.$x."";
}
}
if ($infolink)
{
$ritem = urlencode($realitem);
$xx = explode("'",$realitem);
if (count($xx) == 3)
{
$ritem = urlencode($xx[1].$xx[2]);
}
if ($sgfx)
{
$itembox = $itembox.lpref("
",
"info&item=".$ritem);
}
else
{
$itembox = lpref($itembox,"info&item=".$ritem);
}
}
if (empty($scorp)) $corp = lpref($corp,"sort=&fact=&c=".urlencode($corp));
$disp[] = "| $lp | ".$icon." | ".$itembox." | "
."$costbox | "
."$corp | $flong | ".$qualityimg." | "
."".$date." |
";
$showct++;
if ($showct > $pct) break;
}
}
$pnext = (count($disp) > $pct) ? lpref("Next Page >>>","p=".($p+1)) : "";
$pprev = ($p > 0) ? lpref("<<< Previous Page","p=".($p-1)) : "";
$pcur = (count($disp) && ($pnext || $pprev)) ? " Current Page: ".($p+1)." " : " ";
echo "| $pprev $pcur $pnext |
\n";
if (count($disp)) foreach($disp as $line)
{
$pct--;
if ($pct < $pagelimit && $pct >= 0) echo $line."\n";
}
echo "| $pprev $pcur $pnext |
\n";
unset($db,$qdb);
}
// end of Block 1
else
{
$factionselect = '';
foreach($faction2long as $short => $long)
{
$factionselect .= '';
}
if ($crawler == 0)
{
$f1 = ($igb) ? "#7e7868" : "#eee8d8";
?>
| LP | | Item | Required Items | Corporation |
Faction | Date |
}
unset($f1,$factionselect);
}
$dbcounter = trim(file_get_contents($fn_lpdb_counter));
echo "
$dbcounter items in database. ";
echo "About the LP Store Database.
\n";
?>