Update a few online check pages to final format

This commit is contained in:
Matt Nadareski
2016-03-03 13:10:55 -08:00
parent f58ff90925
commit 5446a1189d
8 changed files with 187 additions and 193 deletions

View File

@@ -22,9 +22,7 @@ Notes:
- Vizzed Possible cookie usage
TODO: Retool existing onlinecheck.php files to follow the new format. 3) check code flow to try to optimize
TODO: Most explode/implode can probably be changed to preg_match, just need to decipher them
TODO: Document all required GET and POST vars for each page
TODO: Comment all of the code...
TODO: VideopacNL uses a cookie to be able to access the board. This means you need to log in to the site and then copy the cookie as a param
TODO: Can we run all online checks in a coherent way (in series, that is)?
------------------------------------------------------------------------------------ */
@@ -45,6 +43,7 @@ foreach ($result as $item)
$dead = array(
"8BitChip",
"8BitCommodoreItalia",
"AcornPreservation",
"Atarimania",
"Cas2Rom",
"Import64",
@@ -55,10 +54,13 @@ $dead = array(
"smartlip",
);
// If we don't have a source set, show the generic page
if (!isset($_GET["source"]))
{
echo "<h2>Please Choose a Site</h2>\n";
echo "Note: got to Apple2Online<br/><br/>\n";
// List all files, auto-generate links to proper pages
$files = scandir("../sites/", SCANDIR_SORT_NONE);
foreach ($files as $file)
@@ -71,7 +73,7 @@ if (!isset($_GET["source"]))
}
}
// List all sites that don't have checkers
// List all sources that don't have checkers
echo "<h2>Sites With No Checker</h2>\n";
// Normalize the arrays because some names don't match 1:1
@@ -86,6 +88,8 @@ if (!isset($_GET["source"]))
$newfiles[] = strtolower($file);
}
$newfiles = str_replace(".php", "", $newfiles);
// Print out the source names with proper capitalization
foreach (array_diff($newsites, $newfiles) as $key => $site)
{
echo $sites[$key]."<br/>\n";
@@ -95,6 +99,7 @@ if (!isset($_GET["source"]))
die();
}
/// If the checker requested doesn't exist, tell the user
elseif (!file_exists("../sites/".$_GET["source"].".php"))
{
echo "<b>The file you supply must be in /sites/</b><br/>";
@@ -103,6 +108,7 @@ elseif (!file_exists("../sites/".$_GET["source"].".php"))
die();
}
// Otherwise, we assume the soruce is good, and we attempt to load it
$source = $_GET["source"];
echo "<h2>Loading pages and links...</h2>";

View File

@@ -32,11 +32,14 @@ $pages = array(
'http://armas.cbm8bit.com/ztaps.html',
);
echo "<table>\n";
foreach ($pages as $newfile)
{
echo "<tr><td>".$newfile."</td>";
$query = get_data($newfile); // Read the whole page into one string
$query = preg_replace('/(\s+)/',' ', $query); // Remove all whitespace
$query = preg_replace('/(\s+)/',' ', $query); // Replace all whitespace with a single space
$query = preg_replace('/(href=)("?)(\S+?)("?)(>)/','\1"\3"\5', $query); // Make sure all hrefs are quoted properly
$query = explode ('<tr ',$query); // Separate lines based on table rows
unset($query[0]); // The first item is never a match so unset it
@@ -46,51 +49,47 @@ foreach ($pages as $newfile)
// For each table row, process and get links
foreach ($query as $row)
{
// If the row is not empty or null
if ($row)
$row = explode('<td', $row); // Separate lines based on table cells
$title = trim(str_replace(" ( NO SCAN YET )", "", strip_tags('<td'.$row[1]))); // Extract the title from the row
$info = trim(strip_tags('<td'.$row[2])); // Extract the information from the row
$dls = explode('tapescans/victaps/', $row[3]); // Get any downloads that can be found in the row
unset($dls[0]); // The first item is never a match so unset it
// For each download found, see if we've included it already
foreach ($dls as $dl)
{
$row = explode('<td', $row); // Separate lines based on table cells
$title = trim(str_replace(" ( NO SCAN YET )", "", strip_tags('<td'.$row[1]))); // Extract the title from the row
$info = trim(strip_tags('<td'.$row[2])); // Extract the information from the row
$dls = explode('tapescans/victaps/', $row[3]); // Get any downloads that can be found in the row
unset($dls[0]); // The first item is never a match so unset it
$dl = explode('"', $dl);
$dl = $dl[0];
$ext = explode('.', $dl);
$ext = $ext[count($ext)-1];
// For each download found, see if we've included it already
foreach ($dls as $dl)
if ($r_query[$dl] != "")
{
// If the download is not empty or null
if ($dl)
{
$dl = explode('"', $dl);
$dl = $dl[0];
$ext = explode('.', $dl);
$ext = $ext[count($ext)-1];
if ($r_query[$dl] != "")
{
$old++;
}
else
{
$found[] = array($dl, $title." (".$info.").".$ext);
$new++;
}
}
$old++;
}
else
{
$found[] = array($dl, $title." (".$info.").".$ext);
$new++;
}
}
}
echo "Loading ".$newfile.$tab;
echo "Found new: ".$new.", old: ".$old."<br/>";
echo "<td>Found new: ".$new.", old: ".$old."</tr>\n";
}
echo "\n";
echo "</table>\n";
if (sizeof($found) > 0)
{
echo "<h2>New files:</h2>";
}
foreach ($found as $row)
{
echo htmlspecialchars($row)."<br/>";
echo "<a href='http://armas.cbm8bit.com/tapescans/victaps/".$row[0]."'>".$row[0]."</a><br/>";
echo "<a href='http://armas.cbm8bit.com/tapescans/victaps/".$row[0]."'>".$row[1]."</a><br/>\n";
}
echo "<br/>\n";
?>

View File

@@ -74,7 +74,7 @@ for ($xpage = 0; $xpage < $max; $xpage++)
if (!$r_query[$url])
{
$found[] = array($title."{".$add."}.".$ext, $url);
$found[] = array($url, $title."{".$add."}.".$ext);
$new++;
}
else
@@ -94,21 +94,14 @@ for ($xpage = 0; $xpage < $max; $xpage++)
print "new: ".$new.", old: ".$old."\n";
}
print "\nnew urls:\n\n";
print "<table><tr><td><pre>";
foreach ($found as $url)
if (sizeof($found) > 0)
{
print $url[1]."\n";
echo "<h2>New files:</h2>";
}
print "</td><td><pre>";
foreach ($found as $url)
foreach ($found as $row)
{
print "<a href=\"http://www.8bitchip.info".$url[1]."\">".$url[0]."</a>\n";
echo "<a href='http://www.8bitchip.info".$row[0]."'>".$row[1]."</a><br/>\n";
}
print "</td></tr></table>";
?>

View File

@@ -6,53 +6,54 @@ $dirs = array(
'http://ann.hollowdreams.com/anndisks.html',
);
print "<pre>check folders:\n\n";
echo "<table>\n";
foreach ($dirs as $dir)
{
if ($dir)
echo "<tr><td>".$dir."</td>";
$query = get_data($dir);
$query = explode(' href="', $query);
$query[0] = null;
$new = 0;
$old = 0;
foreach ($query as $row)
{
print "load: ".$dir."\n";
$query = get_data($dir);
$query = explode(' href="', $query);
$query[0] = null;
$new = 0;
$old = 0;
foreach ($query as $row)
if ($row)
{
if ($row)
$url = explode('"', $row);
$url = $url[0];
$ext = explode('.', $url);
if (!$r_query[$url])
{
$url = explode('"', $row);
$url = $url[0];
$ext = explode('.', $url);
if (!$r_query[$url])
{
$found[] = $url;
$new++;
}
else
{
$old++;
}
$found[] = $url;
$new++;
}
else
{
$old++;
}
}
print "close: ".$dir."\n";
print "new: ".$new.", old: ".$old."\n";
}
echo "<td>Found new: ".$new.", old: ".$old."</tr>\n";
}
print "\nnew urls:\n\n";
echo "</table>\n";
foreach ($found as $url)
if (sizeof($found) > 0)
{
print "<a href=\"http://ann.hollowdreams.com/".$url."\">".$url."</a>\n";
echo "<h2>New files:</h2>";
}
foreach ($found as $row)
{
echo "<a href='".$row."'>".$row."</a><br/>\n";
}
echo "<br/>\n";
?>

View File

@@ -2,7 +2,7 @@
// Original code: The Wizard of DATz
$pages = Array(
$pages = array(
"http://www.acornpreservation.org/main_tapes_games.html",
"http://www.acornpreservation.org/main_discs_games.html",
);
@@ -17,40 +17,42 @@ foreach ($pages as $page)
$content = get_data($page);
$content = explode('HREF="', $content);
$content[0] = null;
unset($content[0]);
foreach ($content as $row)
{
if ($row)
{
$url = explode('"', $row);
$url = $url[0];
$ext = explode('.', $url);
$url = explode('"', $row);
$url = $url[0];
$ext = explode('.', $url);
if (strtolower($ext[count($ext)-1])=='zip')
if (strtolower($ext[count($ext)-1])=='zip')
{
if (!$r_query[$url])
{
if (!$r_query[$url])
{
$found[] = $url;
$new++;
}
else
{
$old++;
}
$found[] = $url;
$new++;
}
else
{
$other++;
$old++;
}
}
else
{
$other++;
}
}
print "new ".$new.", old ".$old.", other ".$other."<br/>\n";
}
if (sizeof($found) > 0)
{
echo "<h2>New files:</h2>";
}
foreach ($found as $row)
{
print "<a href=\"http://www.acornpreservation.org/".$row."\">".$row."</a><br/>\n";
echo "<a href='http://www.acornpreservation.org/".$row."'>".$row."</a><br/>\n";
}
?>

View File

@@ -28,103 +28,89 @@ $dirs = array(
'http://amstrad.es/publicaciones/publicaciones/cintas/index.html',
);
print "<pre>check folders:\n\n";
echo "<table>\n";
foreach ($dirs as $dir)
{
if ($dir)
echo "<tr><td>".$dir."</td>";
$query = str_replace("\r\n", '', get_data($dir));
$query = explode('<p> <a href="', $query);
if (!$query[1])
{
print "load: ".$dir."\n";
$query = str_replace("\r\n", '', get_data($dir));
$query = explode('<p> <a href="', $query);
if (!$query[1])
$query = explode('<a class="teaserlink" href="', $query[0]);
}
$query[0] = null;
$t_dir = explode("/", $dir);
$t_dir[count($t_dir) - 1] = null;
$t_dir = implode("/", $t_dir);
foreach ($query as $row)
{
$new = 0;
$old = 0;
$url = explode('"', $row);
$url = $t_dir.$url[0];
//print "found: ".$url."\n";
$text = explode('</a>', $row);
$ext = explode('<', $text[1]);
$text = explode('>', $text[0]);
$text = trim($text[1]);
$ext = trim($ext[0]);
$text = strtr($text.' ('.str_replace(', ',') (',$ext).')', $normalize_chars);
$query2 = get_data($url);
$query2 = explode('<a href="', $query2);
$query2[0] = null;
$dl_dir = explode("/", $url);
$dl_dir[count($dl_dir) - 1] = null;
$dl_dir = implode("/", $dl_dir);
foreach ($query2 as $dl)
{
$query = explode('<a class="teaserlink" href="', $query[0]);
}
$query[0] = null;
$t_dir = explode("/", $dir);
$t_dir[count($t_dir) - 1] = null;
$t_dir = implode("/", $t_dir);
foreach ($query as $row)
{
if ($row)
{
$new = 0;
$old = 0;
$url = explode('"', $row);
$url = $t_dir.$url[0];
print "found: ".$url."\n";
$text = explode('</a>', $row);
$ext = explode('<', $text[1]);
$text = explode('>', $text[0]);
$text = trim($text[1]);
$ext = trim($ext[0]);
$text = strtr($text.' ('.str_replace(', ',') (',$ext).')', $normalize_chars);
$query2 = get_data($url);
$query2 = explode('<a href="', $query2);
$query2[0] = null;
$dl_dir = explode("/", $url);
$dl_dir[count($dl_dir) - 1] = null;
$dl_dir = implode("/", $dl_dir);
foreach ($query2 as $dl)
$url2 = explode('"', $dl);
$url2 = $dl_dir.$url2[0];
$ext = explode(".", $url2);
$ext = $ext[count($ext) - 1];
$dltext = explode('</a>', $dl);
$dltext = trim(strip_tags('<a href="'.$dltext[0]));
if ($dltext && $dltext != 'Share')
{
if ($dl)
if (!$r_query[$url2])
{
$url2 = explode('"', $dl);
$url2 = $dl_dir.$url2[0];
$ext = explode(".", $url2);
$ext = $ext[count($ext) - 1];
$dltext = explode('</a>', $dl);
$dltext = trim(strip_tags('<a href="'.$dltext[0]));
if ($dltext && $dltext != 'Share')
{
if (!$r_query[$url2])
{
$found[] = array($url2,$text.' {'.$dltext.'}.'.$ext);
$new++;
}
else
{
$old++;
}
}
$found[] = array($url2,$text.' {'.$dltext.'}.'.$ext);
$new++;
}
else
{
$old++;
}
}
print "new: ".$new.", old: ".$old."\n";
}
}
echo "<td>Found new: ".$new.", old: ".$old."</tr>\n";
}
}
print "\nnew urls:\n\n";
echo "</table>\n";
print "<table><tr><td><pre>";
foreach($found as $row)
if (sizeof($found) > 0)
{
print $row[0]."\n";
echo "<h2>New files:</h2>";
}
print "</td><td><pre>";
foreach($found as $row)
foreach ($found as $row)
{
print "<a href=\"".$row[0]."\" target=_blank>".$row[1]."</a>\n";
echo "<a href='".$row[0]."'>".$row[1]."</a><br/>\n";
}
print "</td></tr></table>";
echo "<br/>\n";
?>

View File

@@ -2,8 +2,6 @@
// Original code: The Wizard of DATz
print "<pre>";
$dir = "http://apple2online.com/";
print "load: ".$dir."\n";
$query = get_data($dir);

View File

@@ -6,9 +6,10 @@ $newfiles = array(
'https://alexvampire.wordpress.com/feed/',
);
echo "<table>\n";
foreach ($newfiles as $newfile)
{
print "load ".$newfile."<br/>\n";
echo "<tr><td>".$newfile."</td>";
$query = get_data($newfile);
$query = explode('<link>', $query);
$query[0] = null;
@@ -34,13 +35,21 @@ foreach ($newfiles as $newfile)
}
}
}
foreach ($found as $row)
{
print "<a href=\"".$row."\">".$row."</a><br/>\n";
}
print "found new:".$new.", old:".$old."<br/>\n<br/>\n";
echo "<td>Found new: ".$new.", old: ".$old."</tr>\n";
}
echo "</table>\n";
if (sizeof($found) > 0)
{
echo "<h2>New files:</h2>";
}
foreach ($found as $row)
{
echo "<a href='".$row."'>".$row."</a><br/>\n";
}
echo "<br/>\n";
?>