Skip to content

Commit 6ef393e

Browse files
author
jantje
committed
Making stable download pages 1 dynamic page
Updated file-buttons so it finds the 32 and 64 in the name even wint win and lin. stable.php should do the trick now.
1 parent 0595866 commit 6ef393e

File tree

2 files changed

+107
-91
lines changed

2 files changed

+107
-91
lines changed
Lines changed: 36 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,38 @@
11
<?php
2-
if(isset($_GET["ver"]) && isset($_GET["arch"]))
3-
listFiles("V" . $_GET["ver"] . '_' . $_GET["arch"]);
4-
5-
function listFiles($prefix) {
6-
global $filter;
7-
$filter = $prefix;
8-
date_default_timezone_set('UTC');
9-
$location="/customers/0/9/d/baeyens.it/httpd.www/eclipse/download/product";
10-
echo "<!-- listing files in $location with prefix $prefix -->";
11-
$dir = opendir($location);
12-
while(false != ($file = readdir($dir))) {
13-
if(($file != ".") and ($file != "..") and ($file != "index.php")) {
14-
$files[] = $location."/".$file; // put in array.
15-
}
16-
}
17-
closedir($dir);
18-
$files = array_filter($files, "filter");
19-
sort($files);
20-
$count = count($files);
21-
if ($count == 1) {
22-
$curfile=basename($files[0]);
23-
echo '<div class="text-center col-md-4 col-md-offset-4">';
24-
echo ' <a href="http://eclipse.baeyens.it/download/product/' . $curfile . '?forcedownload" class="btn btn-success btn-lg text-center">Download <b>' . substr($curfile, strlen($prefix), 2) . ' bits</b> Bundle <i class="glyphicon glyphicon-cloud-download"></i></a>';
25-
echo '</div>';
26-
} else if ($count == 2) {
27-
$curfile=basename($files[0]);
28-
echo '<div class="text-center col-md-3 col-md-offset-3">';
29-
echo ' <a href="http://eclipse.baeyens.it/download/product/' . $curfile . '?forcedownload" class="btn btn-success btn-lg text-center">Download <b>' . substr($curfile, strlen($prefix), 2) . ' bits</b> Bundle <i class="glyphicon glyphicon-cloud-download"></i></a>';
30-
echo '</div>';
31-
$curfile=basename($files[1]);
32-
echo '<div class="text-center col-md-3">';
33-
echo ' <a href="http://eclipse.baeyens.it/download/product/' . $curfile . '?forcedownload" class="btn btn-success btn-lg text-center">Download <b>' . substr($curfile, strlen($prefix), 2) . ' bits</b> Bundle <i class="glyphicon glyphicon-cloud-download"></i></a>';
34-
echo '</div>';
35-
} else {
36-
echo "<!-- there are $count files in $location with prefix $prefix -->";
37-
}
38-
}
39-
function filter($file) {
40-
global $filter;
41-
return(substr(basename($file), 0, strlen($filter)) == $filter);
42-
}
2+
if (isset ( $_GET ["ver"] ) && isset ( $_GET ["arch"] ))
3+
listFiles ( "V" . $_GET ["ver"] . '_' . $_GET ["arch"] );
4+
function my_offset($curfile, $prefix) {
5+
preg_match ( '/\d/', $curfile, $m, PREG_OFFSET_CAPTURE, strlen ( $prefix ) );
6+
if (sizeof ( $m ))
7+
return $m [0] [1];
8+
return strlen ( $prefix );
9+
}
10+
function my_bitness($curfile, $prefix) {
11+
return substr ( $curfile, my_offset ( $curfile, $prefix ), 2 );
12+
}
13+
function listFiles($prefix) {
14+
global $filter;
15+
$filter = $prefix;
16+
date_default_timezone_set ( 'UTC' );
17+
$location = "/customers/0/9/d/baeyens.it/httpd.www/eclipse/download/product";
18+
$dir = opendir ( $location );
19+
while ( false != ($file = readdir ( $dir )) ) {
20+
if (($file != ".") and ($file != "..") and ($file != "index.php")) {
21+
$files [] = $location . "/" . $file; // put in array.
22+
}
23+
}
24+
closedir ( $dir );
25+
$files = array_filter ( $files, "filter" );
26+
sort ( $files );
27+
foreach ( $files as &$file ) {
28+
$curfile = basename ( $file );
29+
echo '<div class="text-center col-md-4 col-md-offset-4">';
30+
echo ' <a href="http://eclipse.baeyens.it/download/product/' . $curfile . '" class="btn btn-success btn-lg text-center">Download <b>' . my_bitness ( $curfile, $prefix ) . ' bits</b> Bundle <i class="glyphicon glyphicon-cloud-download"></i></a>';
31+
echo '</div>';
32+
}
33+
}
34+
function filter($file) {
35+
global $filter;
36+
return (substr ( basename ( $file ), 0, strlen ( $filter ) ) == $filter);
37+
}
4338
?>
Lines changed: 71 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,94 @@
11
<?php
2-
if(isset($_GET["OS"]) )
3-
$OS = $_GET["OS"] ;
4-
$os = $OS; ?>
5-
2+
require 'fragments/file-buttons.php';
3+
$version = "3.0";
4+
5+
if (isset ( $_GET ["OS"] ))
6+
$OS = $_GET ["OS"];
7+
$os = strtolower ( substr ( $OS, 0, 3 ) );
8+
?>
9+
610
<!DOCTYPE html>
711
<html lang="en">
8-
<head>
9-
<meta charset="utf-8">
10-
<meta http-equiv="X-UA-Compatible" content="IE=edge">
11-
<meta name="viewport" content="width=device-width, initial-scale=1">
12-
<meta name="description" content="">
13-
<meta name="author" content="Roberto Lo Giacco">
14-
<link rel="shortcut icon" href="http://eclipse.baeyens.it/favicon.ico">
12+
<head>
13+
<meta charset="utf-8">
14+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
15+
<meta name="viewport" content="width=device-width, initial-scale=1">
16+
<meta name="description" content="">
17+
<meta name="author" content="Roberto Lo Giacco">
18+
<link rel="shortcut icon" href="http://eclipse.baeyens.it/favicon.ico">
1519

1620

1721
<?php echo "<title>Arduino Eclipse IDE - $OS Latest Stable</title>"; ?>
1822

1923
<!-- Bootstrap core CSS and theme -->
20-
<link rel="stylesheet" href="https://netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css">
21-
<link rel="stylesheet" href="https://netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap-theme.min.css">
24+
<link rel="stylesheet"
25+
href="https://netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css">
26+
<link rel="stylesheet"
27+
href="https://netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap-theme.min.css">
2228

23-
<!-- Custom styles -->
24-
<link href='http://fonts.googleapis.com/css?family=Open+Sans:300italic,600italic,600,300|Open+Sans+Condensed:300,700|Ubuntu+Mono:400,700,400italic,700italic' rel='stylesheet' type='text/css'>
25-
<link href="css/theme.css" rel="stylesheet">
29+
<!-- Custom styles -->
30+
<link
31+
href='http://fonts.googleapis.com/css?family=Open+Sans:300italic,600italic,600,300|Open+Sans+Condensed:300,700|Ubuntu+Mono:400,700,400italic,700italic'
32+
rel='stylesheet' type='text/css'>
33+
<link href="css/theme.css" rel="stylesheet">
2634

27-
</head>
35+
</head>
2836

29-
<body role="document" >
37+
<body role="document">
3038

31-
<!-- Fixed navbar -->
32-
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
39+
<!-- Fixed navbar -->
40+
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
3341
<?php include 'fragments/navbar.html';?>
3442
</nav>
3543

36-
<div class="container" role="main">
37-
<div class="page-header">
44+
<div class="container" role="main">
45+
<div class="page-header">
3846
<?php echo "<h1>$OS Latest Stable <small>runs smoothly and nicely</small></h1>"; ?>
3947
<a name="top">&nbsp;</a>
48+
</div>
49+
<p>This is the latest stable build of Arduino Eclipse IDE and it's
50+
available as a product and a plugin: pick the one you prefer!</p>
51+
<h3>Product bundle</h3>
52+
<a name="product">&nbsp;</a>
53+
<p>Strongly advised when you are new to the Arduino eclipse IDE.</p>
54+
<p>This is the simplest way to start using Arduino Eclipse as it
55+
bundles in one single download a complete setup including a stable
56+
version of the Eclipse CDT and the latest stable build of our great
57+
Arduino eclipse IDE!</p>
58+
<p>Watch this movie to see how easy it is to get started:</p>
59+
<iframe width="560" height="315"
60+
src="https://www.youtube.com/embed/HE5iYxv-B-o" frameborder="0"
61+
allowfullscreen></iframe>
62+
<div class="row">
63+
<?php listFiles("V" . $version . '_' . $os);?>
4064
</div>
41-
<p>This is the latest stable build of Arduino Eclipse IDE and it's available as a product and a plugin: pick the one you prefer!</p>
42-
<h3>Product bundle</h3>
43-
<a name="product">&nbsp;</a>
44-
<p>Strongly advised when you are new to the Arduino eclipse IDE.</p>
45-
<p>This is the simplest way to start using Arduino Eclipse as it bundles in one single download a complete setup including a stable version of the Eclipse CDT and the latest stable build of our great Arduino eclipse IDE!</p>
46-
<p>Watch this movie to see how easy it is to get started:</p>
47-
<iframe width="560" height="315" src="https://www.youtube.com/embed/HE5iYxv-B-o" frameborder="0" allowfullscreen></iframe>
48-
<div class="row">
49-
<?php include 'fragments/file-buttons.php?arch=$OS&ver=3.0';?>
50-
</div>
51-
<a href="#top" scroll-to="top">Back to top</a>
52-
<h3>Plugin update site</h3><a name="plugin">&nbsp;</a>
53-
<p>If you want to pick a different version of the Eclipse CDT than the one included in the product bundle or you want to add the Arduino Eclipse plugin to an existing installation this is the way to go.</p>
54-
<div class="row">
55-
<div class="col-md-4 col-md-offset-4">
56-
<div class="well text-center">http://www.baeyens.it/eclipse/V3</div>
57-
</div>
58-
</div>
59-
</div><!-- /container -->
65+
<a href="#top" scroll-to="top">Back to top</a>
66+
<h3>Plugin update site</h3>
67+
<a name="plugin">&nbsp;</a>
68+
<p>If you want to pick a different version of the Eclipse CDT than the
69+
one included in the product bundle or you want to add the Arduino
70+
Eclipse plugin to an existing installation this is the way to go.</p>
71+
<div class="row">
72+
<div class="col-md-4 col-md-offset-4">
73+
<div class="well text-center">http://www.baeyens.it/eclipse/V3</div>
74+
</div>
75+
</div>
76+
</div>
77+
<!-- /container -->
6078

61-
<div id="footer">
79+
<div id="footer">
6280
<?php include 'fragments/footer.html';?>
6381
</div>
64-
</body>
82+
</body>
6583

66-
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
67-
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.1.0/js/bootstrap.min.js"></script>
68-
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.min.js"></script>
69-
<script src="js/marked.min.js"></script>
70-
<script src="js/angular-marked.min.js"></script>
71-
<script src="js/ui-bootstrap-tpls.js"></script>
72-
<script src="js/app.js"></script>
84+
<script
85+
src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
86+
<script
87+
src="https://maxcdn.bootstrapcdn.com/bootstrap/3.1.0/js/bootstrap.min.js"></script>
88+
<script
89+
src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.min.js"></script>
90+
<script src="js/marked.min.js"></script>
91+
<script src="js/angular-marked.min.js"></script>
92+
<script src="js/ui-bootstrap-tpls.js"></script>
93+
<script src="js/app.js"></script>
7394
</html>

0 commit comments

Comments
 (0)