summaryrefslogtreecommitdiff
path: root/issue.php
blob: 3a3ed6f697a4f3beaaa3d16494c621cea1e533bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<!DOCTYPE html>
<?php
function page($page, $count=1) {
	if (file_exists("Page${page}.pdf")) {
		echo "<td id='page${page}' class='pages-${count}' colspan='${count}'>";
		echo "<img src='Page${page}.small.jpg' />";
		echo "</td>\n";
	} else {
		echo "<td class='pages-${count} filler'> </td>\n";
	}
}

function pages($first, $last) {
	if (file_exists("Pages${first}-${last}.pdf")) {
		page("s${first}-${last}", ($last-$first)+1);
	} else {
		$exists = false;
		for ($i=$first; $i<=$last; $i++) {
			$exists |= file_exists("Page${i}.pdf");
		}
		if ($exists) {
			for ($i=$first; $i<=$last; $i++) {
				page($i);
			}
		} else {
			return false;
		}
	}
	return true;
}

?>
<html dir="ltr" lang="en-US">
  <head>
    <meta charset="UTF-8" />
    <title>North Star issue <?php echo basename(dirname(__FILE__)) ?></title>
    <link rel="stylesheet" href="view.css" .>
    <script type="text/javascript" src="/wp-includes/js/jquery/jquery.js?ver=1.7.1"></script>
    <script type="text/javascript" src="view.js"></script>
  </head>
  <body>
    <div class="menu">Please give the paper a moment to load.</div>
    <div class="spacer"> </div>
    <table class="paper">
      <?php $i=0; $still_going=true; while ($still_going) { ?>
      <tr>
	<?php $still_going = pages($i, $i+1); $i+=2; ?>
      </tr>
      <?php } ?>
    </table>
  </body>
</html>