Skip to content
Permalink
Browse files

Submitted by: matt@

Reviewed by:    jmpp@

Thanks to Matt for these php scripts that give our downloads section the
same sexy look as the rest of our site.

git-svn-id: https://svn.macports.org/repository/macports/trunk/www@14587 d073be05-634f-4543-b044-5fe20cf6d1d6
  • Loading branch information
jmpalacios committed Oct 12, 2005
1 parent 8334939 commit 4ffabf0dfe0c12d5284a6262f157b568b2f0aea9
Showing with 49 additions and 0 deletions.
  1. +17 −0 downloads/download.php
  2. +32 −0 downloads/index.php
@@ -0,0 +1,17 @@
<?
$tableau = explode (".", $file);
$nb_element_1 = count ($tableau) -1;
if ($tableau[$nb_element_1] != "php") {
header("Content-disposition: attachment; filename=$file");
header("Content-Type: application/force-download");
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".filesize("./".$file));
header("Pragma: no-cache");
header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
header("Expires: 0");
readfile("./".$file);
}
else {
header("Location: index.php");
}
?>
@@ -0,0 +1,32 @@
<?php
$DOCUMENT_ROOT = $_SERVER['DOCUMENT_ROOT'];
include_once("$DOCUMENT_ROOT/includes/common.inc");
include_once("$DOCUMENT_ROOT/includes/functions.inc");
print_header('DarwinPorts Downloads', 'iso-8859-1');
?>

<div id="content">

<h2 class="hdr">Available Downloads</h2>
<p>
<?php
$dossier = opendir ("./");

while ($fichier = readdir ($dossier)) {
if ($fichier != "." && $fichier != "..") {
$tableau = explode (".", $fichier);
$nb_element_1 = count ($tableau) -1;
if ($tableau[$nb_element_1] != "php") {
echo '<a href="./download.php?file='.$fichier.'">'.$fichier.'</a><br />';
}
}
}
closedir ($dossier);
?>
</p>
</div>
</div>

<?php
print_footer();
?>

0 comments on commit 4ffabf0

Please sign in to comment.
You can’t perform that action at this time.