Skip to content

Instantly share code, notes, and snippets.

@uvbeenzaned
Last active December 14, 2015 14:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save uvbeenzaned/5102835 to your computer and use it in GitHub Desktop.
Save uvbeenzaned/5102835 to your computer and use it in GitHub Desktop.
Networkery BukkitDev Index Service
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<title>
NBDIS
</title>
<?php if(!isset($_GET["m"]) || empty($_GET["m"]) || $_GET["m"] != "override"){echo("<script>(function(a,b){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4)))window.location=b})(navigator.userAgent||navigator.vendor||window.opera,'/mobile');</script>");}?>
<script>
function init()
{
document.getElementById('sb').focus();
}
function goPage()
{
document.forms["pgnumform"].submit();
}
function raw()
{
document.forms["searchform"].action="raw/";
}
function rss()
{
document.forms["searchform"].action="rss/";
}
</script>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body onload="init()">
<div id="content">
<div id="searchgroup">
<a href="/"><img id="himg" src="images/logo-125.png" alt="logo"></a>
<div id="searchtext">
<form id="searchform" action="<?php echo dirname($_SERVER['SCRIPT_NAME']) ?>" method="get">
Search: <input id="sb" type="search" name="s" <?php if(isset($_GET['s'])){echo("value=\"". $_GET['s'] ."\"");}else{echo("placeholder=\"[input terms]\"");}?>><input type="submit" value="search"><input type="submit" value="get raw list" onclick="raw()"><input type="submit" value="generate RSS feed" onclick="rss()"><br>
Note: If using the "OR" or "AND" operators, space your keywords out to get results unless it is only one word.<br>
Search type: <input type="radio" name="t" value="and" <?php if(isset($_GET['t'])&&$_GET['t']=="and"){echo("checked=\"checked\"");}else{echo("checked=\"checked\"");}?>>AND <input type="radio" name="t" value="or" <?php if(isset($_GET['t'])&&$_GET['t']=="or"){echo("checked=\"checked\"");}?>>OR <input type="radio" name="t" value="exact" <?php if(isset($_GET['t'])&&$_GET['t']=="exact"){echo("checked=\"checked\"");}?>>Exact Match <input type="radio" name="t" value="author" <?php if(isset($_GET['t'])&&$_GET['t']=="author"){echo("checked=\"checked\"");}?>>Author(AND)<br>Sort type: <input type="radio" name="o" value="updated" <?php if(isset($_GET['o'])&&$_GET['o']=="updated"){echo("checked=\"checked\"");}else{echo("checked=\"checked\"");}?>>Most Recently Updated <input type="radio" name="o" value="alpha" <?php if(isset($_GET['o'])&&$_GET['o']=="alpha"){echo("checked=\"checked\"");}?>>Alphabetically<br>Status Filter: <input type="checkbox" name="f" value="inactive" <?php if(isset($_GET['f'])&&$_GET['f']=="inactive"){echo("checked");}?>> Don't show inactive<input type="checkbox" name="f1" value="planning" <?php if(isset($_GET['f1'])&&$_GET['f1']=="planning"){echo("checked");}?>>Don't show planning
</form>
</div>
</div>
<!--begin plugin table-->
<table id="items">
<thead>
<tr>
<th>
#
</th>
<th>
Name
</th>
<th>
Link
</th>
<th>
Last Update Time
</th>
<th>
Author(s)
</th>
<th>
Status
</th>
</tr>
</thead>
<?php
error_reporting(E_ALL & ~E_NOTICE);
date_default_timezone_set('America/Chicago');
$plugins=array();
$pltotal=1;
$file=fopen("/var/www-download/bukkitdev/dev.bukkit.org-dumps/latest.csv","r") or exit("Unable to find latest.csv file!");
while (!feof($file))
{
array_push($plugins, fgets($file));
$pltotal++;
}
if (isset($_GET["o"]) && $_GET["o"] == "alpha")
{
sort($plugins, SORT_NATURAL | SORT_FLAG_CASE);
}
reset($plugins);
fclose($file);
$icnt=0;
$icntstart=0;
$icntend=100;
if (isset($_GET["pgnum"]) && !empty($_GET["pgnum"]))
{
$icntstart=($_GET["pgnum"]*100)-100;
$icntend=$_GET["pgnum"]*100;
}
$alt=false;
if (empty($_GET["s"]) || !isset($_GET["s"]) || $_GET["s"] == " ")
{
if (!isset($_GET["all"]) || empty($_GET["all"]))
{
foreach ($plugins as $plugin)
{
if ($icnt >= $icntstart)
{
$str=$plugin;
$arr=str_getcsv($str, ",", "\"");
$name=$arr[0];
$link=$arr[1];
$date=str_replace("at", "", $arr[2]);
$author=$arr[3];
$status=$arr[4];
if((!isset($_GET['f']) && !isset($_GET['f1'])) || ($_GET['f'] != strtolower($status) && $_GET['f1'] != strtolower($status)))
{
$icnt++;
if (!empty($str))
{
if ($alt==false)
{
echo("<tr>");
$alt=true;
}
else
{
echo("<tr class=\"alt\">");
$alt=false;
}
echo("<td>". $icnt .".</td>");
echo("<td>". $name ."</td>");
echo("<td><a href=\"". $link ."\" target=\"_blank\">". $link ."</a></td>");
echo("<td>". date("F j, Y, g:i a", strtotime($date)) ."</td>");
echo("<td>");
$autharray=str_getcsv($author, ",");
$addc=false;
foreach ($autharray as $auth)
{
$authtrimmed=trim($auth);
if ($addc)
{
echo(", <a href=\"http://dev.bukkit.org/profiles/". $authtrimmed ."\" target=\"_blank\">". $authtrimmed ."</a>");
}
else
{
echo("<a href=\"http://dev.bukkit.org/profiles/". $authtrimmed ."\" target=\"_blank\">". $authtrimmed ."</a>");
$addc=true;
}
}
echo("</td>");
echo("<td>");
echo($status);
echo("</td>");
echo("</tr>");
if ($icnt >= $icntend)
{
break;
}
}
}
}
else
{
$icnt++;
}
}
echo("<tr><td></td>");
if (!isset($_GET["pgnum"]) || empty($_GET["pgnum"]))
{
echo("<td>Showing 100 most recently updated plugins.</td>");
}
else
{
echo("<td></td>");
}
echo("<td></td><td></td><td></td><td>");
echo("<form id=\"pgnumform\" action=\"". dirname($_SERVER['SCRIPT_NAME']) ."\"><a href=\"?all=true\">Show all</a> | <select name=\"pgnum\" onchange=\"goPage()\">");
$cntu=1;
for ($pn=($pltotal/100)+1; $pn>=$cntu; $cntu++)
{
if (isset($_GET["pgnum"]) && !empty($_GET["pgnum"]) && $_GET["pgnum"]==$cntu)
{
echo("<option value=\"". floor($cntu) ."\" selected>Page ". floor($cntu) ."</option>");
}
else
{
echo("<option value=\"". floor($cntu) ."\">Page ". floor($cntu) ."</option>");
}
}
echo("</select></form></td>");
echo("</tr>");
}
else
{
foreach ($plugins as $plugin)
{
$str=$plugin;
$arr=str_getcsv($str, ",", "\"");
$name=$arr[0];
$link=$arr[1];
$date=str_replace("at", "", $arr[2]);
$author=$arr[3];
$status=$arr[4];
if((!isset($_GET['f']) && !isset($_GET['f1'])) || ($_GET['f'] != strtolower($status) && $_GET['f1'] != strtolower($status)))
{
$icnt++;
if (!empty($str))
{
if ($alt==false)
{
echo("<tr>");
$alt=true;
}
else
{
echo("<tr class=\"alt\">");
$alt=false;
}
echo("<td>". $icnt .".</td>");
echo("<td>". $name ."</td>");
echo("<td><a href=\"". $link ."\" target=\"_blank\">". $link ."</a></td>");
echo("<td>". date("F j, Y, g:i a", strtotime($date)) ."</td>");
echo("<td>");
$autharray=str_getcsv($author, ",");
$addc=false;
foreach ($autharray as $auth)
{
$authtrimmed=trim($auth);
if ($addc)
{
echo(", <a href=\"http://dev.bukkit.org/profiles/". $authtrimmed ."\" target=\"_blank\">". $authtrimmed ."</a>");
}
else
{
echo("<a href=\"http://dev.bukkit.org/profiles/". $authtrimmed ."\" target=\"_blank\">". $authtrimmed ."</a>");
$addc=true;
}
}
echo("</td>");
echo("<td>");
echo($status);
echo("</td>");
echo("</tr>");
}
}
}
}
}
else
{
switch (strtolower(trim($_GET["t"])))
{
case "or":
foreach ($plugins as $plugin)
{
$str=$plugin;
$arr=str_getcsv($str, ",", "\"");
$name=$arr[0];
$link=$arr[1];
$date=str_replace("at", "", $arr[2]);
$author=$arr[3];
$status=$arr[4];
foreach(explode(" ", trim($_GET["s"])) as $word)
{
if((!isset($_GET['f']) && !isset($_GET['f1'])) || ($_GET['f'] != strtolower($status) && $_GET['f1'] != strtolower($status)))
{
if (strpos(strtolower($name), strtolower($word)) !== false)
{
$icnt++;
if ($alt==false)
{
echo("<tr>");
$alt=true;
}
else
{
echo("<tr class=\"alt\">");
$alt=false;
}
echo("<td>". $icnt .".</td>");
echo("<td>". $name ."</td>");
echo("<td><a href=\"". $link ."\" target=\"_blank\">". $link ."</a></td>");
echo("<td>". date("F j, Y, g:i a", strtotime($date)) ."</td>");
echo("<td>");
$autharray=str_getcsv($author, ",");
$addc=false;
foreach ($autharray as $auth)
{
$authtrimmed=trim($auth);
if ($addc)
{
echo(", <a href=\"http://dev.bukkit.org/profiles/". $authtrimmed ."\" target=\"_blank\">". $authtrimmed ."</a>");
}
else
{
echo("<a href=\"http://dev.bukkit.org/profiles/". $authtrimmed ."\" target=\"_blank\">". $authtrimmed ."</a>");
$addc=true;
}
}
echo("</td>");
echo("<td>");
echo($status);
echo("</td>");
echo("</tr>");
break;
}
}
}
}
break;
case "and":
foreach ($plugins as $plugin)
{
$str=$plugin;
$arr=str_getcsv($str, ",", "\"");
$name=$arr[0];
$link=$arr[1];
$date=str_replace("at", "", $arr[2]);
$author=$arr[3];
$status=$arr[4];
$add=false;
foreach(explode(" ", trim($_GET["s"])) as $word)
{
if (strpos(strtolower($name), strtolower($word)) !== false)
{
$add=true;
}
else
{
$add=false;
break;
}
}
if((!isset($_GET['f']) && !isset($_GET['f1'])) || ($_GET['f'] != strtolower($status) && $_GET['f1'] != strtolower($status)))
{
if ($add)
{
$icnt++;
if ($alt==false)
{
echo("<tr>");
$alt=true;
}
else
{
echo("<tr class=\"alt\">");
$alt=false;
}
echo("<td>". $icnt .".</td>");
echo("<td>". $name ."</td>");
echo("<td><a href=\"". $link ."\" target=\"_blank\">". $link ."</a></td>");
echo("<td>". date("F j, Y, g:i a", strtotime($date)) ."</td>");
echo("<td>");
$autharray=str_getcsv($author, ",");
$addc=false;
foreach ($autharray as $auth)
{
$authtrimmed=trim($auth);
if ($addc)
{
echo(", <a href=\"http://dev.bukkit.org/profiles/". $authtrimmed ."\" target=\"_blank\">". $authtrimmed ."</a>");
}
else
{
echo("<a href=\"http://dev.bukkit.org/profiles/". $authtrimmed ."\" target=\"_blank\">". $authtrimmed ."</a>");
$addc=true;
}
}
echo("</td>");
echo("<td>");
echo($status);
echo("</td>");
echo("</tr>");
}
}
}
break;
case "exact":
foreach ($plugins as $plugin)
{
$str=$plugin;
$arr=str_getcsv($str, ",", "\"");
$name=$arr[0];
$link=$arr[1];
$date=str_replace("at", "", $arr[2]);
$author=$arr[3];
$status=$arr[4];
if((!isset($_GET['f']) && !isset($_GET['f1'])) || ($_GET['f'] != strtolower($status) && $_GET['f1'] != strtolower($status)))
{
if (strtolower($name) == strtolower(trim($_GET["s"])))
{
$icnt++;
if ($alt==false)
{
echo("<tr>");
$alt=true;
}
else
{
echo("<tr class=\"alt\">");
$alt=false;
}
echo("<td>". $icnt .".</td>");
echo("<td>". $name ."</td>");
echo("<td><a href=\"". $link ."\" target=\"_blank\">". $link ."</a></td>");
echo("<td>". date("F j, Y, g:i a", strtotime($date)) ."</td>");
echo("<td>");
$autharray=str_getcsv($author, ",");
$addc=false;
foreach ($autharray as $auth)
{
$authtrimmed=trim($auth);
if ($addc)
{
echo(", <a href=\"http://dev.bukkit.org/profiles/". $authtrimmed ."\" target=\"_blank\">". $authtrimmed ."</a>");
}
else
{
echo("<a href=\"http://dev.bukkit.org/profiles/". $authtrimmed ."\" target=\"_blank\">". $authtrimmed ."</a>");
$addc=true;
}
}
echo("</td>");
echo("<td>");
echo($status);
echo("</td>");
echo("</tr>");
}
}
}
break;
case "author":
foreach ($plugins as $plugin)
{
$str=$plugin;
$arr=str_getcsv($str, ",", "\"");
$name=$arr[0];
$link=$arr[1];
$date=str_replace("at", "", $arr[2]);
$author=$arr[3];
$status=$arr[4];
$add=false;
foreach(explode(" ", trim($_GET["s"])) as $word)
{
if (strpos(strtolower($author), strtolower($word)) !== false)
{
$add=true;
}
else
{
$add=false;
break;
}
}
if((!isset($_GET['f']) && !isset($_GET['f1'])) || ($_GET['f'] != strtolower($status) && $_GET['f1'] != strtolower($status)))
{
if ($add)
{
$icnt++;
if ($alt==false)
{
echo("<tr>");
$alt=true;
}
else
{
echo("<tr class=\"alt\">");
$alt=false;
}
echo("<td>". $icnt .".</td>");
echo("<td>". $name ."</td>");
echo("<td><a href=\"". $link ."\" target=\"_blank\">". $link ."</a></td>");
echo("<td>". date("F j, Y, g:i a", strtotime($date)) ."</td>");
echo("<td>");
$autharray=str_getcsv($author, ",");
$addc=false;
foreach ($autharray as $auth)
{
$authtrimmed=trim($auth);
if ($addc)
{
echo(", <a href=\"http://dev.bukkit.org/profiles/". $authtrimmed ."\" target=\"_blank\">". $authtrimmed ."</a>");
}
else
{
echo("<a href=\"http://dev.bukkit.org/profiles/". $authtrimmed ."\" target=\"_blank\">". $authtrimmed ."</a>");
$addc=true;
}
}
echo("</td>");
echo("<td>");
echo($status);
echo("</td>");
echo("</tr>");
}
}
}
break;
}
}
?>
</table>
<!--end plugin table-->
<div id="footer">
<a href="http://www.networkery.co">Networkery</a> 2014 |
<a href="https://github.com/uvbeenzaned/BPM" target="_blank">check out the service's backend project</a> |
<a href="/v2"> V2 is being worked on</a>
<div id="updated"> updated <?php echo(date("F j, Y, g:i a", filectime('/var/www-download/bukkitdev/dev.bukkit.org-dumps/latest.csv')))?> (UTC-06:00) Central Time (US & Canada) </div>
</div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment