]> git.ozlabs.org Git - ccan/commitdiff
Upload now works, with a bit of hackery.
authorRusty Russell <rusty@rustcorp.com.au>
Sun, 9 Nov 2008 21:49:51 +0000 (08:49 +1100)
committerRusty Russell <rusty@rustcorp.com.au>
Sun, 9 Nov 2008 21:49:51 +0000 (08:49 +1100)
Also, fixed "Archieve" typo in header (Thanks Tim Connors)

Makefile
web/logo.html
web/menulist.html
web/static-configuration
web/uploader.php [deleted file]
web/uploader.php.cpp [new file with mode: 0644]

index e11ddc2794fbdd41c51e697e2eb7edfd5c6be981..d3e05e9fcd256390642547ea701829fa0823705d 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,7 @@
 # V=--verbose for verbose tests.
 
 # This can be overridden on cmdline to generate pages elsewhere.
 # V=--verbose for verbose tests.
 
 # This can be overridden on cmdline to generate pages elsewhere.
-WEBDIR=webpages/
+WEBDIR=~/www/html/ccan/
 
 CFLAGS=-g -Wall -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations -Werror -Iccan -I.
 
 
 CFLAGS=-g -Wall -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations -Werror -Iccan -I.
 
@@ -22,7 +22,7 @@ distclean: clean
        rm -f $(ALL_DEPENDS)
        rm -rf $(WEBDIR)
 
        rm -f $(ALL_DEPENDS)
        rm -rf $(WEBDIR)
 
-webpages: $(WEB_SUBDIRS) $(WEBDIR)/junkcode $(ALL_PAGES) $(WEBDIR)/list.html $(WEBDIR)/index.html $(WEBDIR)/upload.html $(WEBDIR)/example-config.h $(WEBDIR)/ccan.jpg $(DIRECT_TARBALLS) $(DEPEND_TARBALLS) $(WEBDIR)/ccan.tar.bz2 $(WEBDIR)/Makefile-ccan
+webpages: $(WEB_SUBDIRS) $(WEBDIR)/junkcode $(ALL_PAGES) $(WEBDIR)/list.html $(WEBDIR)/index.html $(WEBDIR)/upload.html $(WEBDIR)/uploader.php $(WEBDIR)/example-config.h $(WEBDIR)/ccan.jpg $(DIRECT_TARBALLS) $(DEPEND_TARBALLS) $(WEBDIR)/ccan.tar.bz2 $(WEBDIR)/Makefile-ccan
 
 $(WEB_SUBDIRS):
        mkdir -p $@
 
 $(WEB_SUBDIRS):
        mkdir -p $@
@@ -45,6 +45,10 @@ $(WEBDIR)/list.html: web/staticall.php tools/doc_extract $(DIRECT_TARBALLS) $(DE
 $(WEBDIR)/upload.html: web/staticupload.php
        php5 web/staticupload.php > $@
 
 $(WEBDIR)/upload.html: web/staticupload.php
        php5 web/staticupload.php > $@
 
+# cpp inserts gratuitous linebreaks at start of file, makes for php problems.
+$(WEBDIR)/uploader.php: web/uploader.php.cpp
+       cpp -w -C -P $< | grep . > $@
+
 $(WEBDIR)/index.html: web/staticindex.php
        php5 web/staticindex.php > $@
 
 $(WEBDIR)/index.html: web/staticindex.php
        php5 web/staticindex.php > $@
 
index 61c8f7e717d8b0eb14d3e4d6a6c970da51ff35f6..9a15f28a410bc57fe578d850e31667df09123b23 100644 (file)
@@ -1,5 +1,4 @@
 <?php
 <?php
-session_start();
 // Pages created in subdirs need ../ appended.
 $url_prefix = getenv("URLPREFIX");
 ?>
 // Pages created in subdirs need ../ appended.
 $url_prefix = getenv("URLPREFIX");
 ?>
@@ -14,7 +13,7 @@ $url_prefix = getenv("URLPREFIX");
        <img src="<?=$url_prefix?>ccan.jpg" width="250" height="80">
   </th>
   <th>
        <img src="<?=$url_prefix?>ccan.jpg" width="250" height="80">
   </th>
   <th>
-       <h1>Comprehensive C Archieve Network <h1>
+       <h1>Comprehensive C Archive Network <h1>
   </th>
  </tr>
 </table>
   </th>
  </tr>
 </table>
index aa5993f54703eae3b6797fefac2499e762dec364..bd15a08e32f3d796dc19d69734d9b42116b22640 100644 (file)
@@ -1,5 +1,4 @@
 <?php
 <?php
-session_start();
 // Pages created in subdirs need ../ appended.
 $url_prefix = getenv("URLPREFIX");
 ?>
 // Pages created in subdirs need ../ appended.
 $url_prefix = getenv("URLPREFIX");
 ?>
index 3ff84923a073544b21b809831f05cd16fba1c2a7..f0fcb89e9de3ea90627ee9fb3d522e08bfe442b1 100644 (file)
@@ -25,7 +25,7 @@ function extract_field($field,$module)
    return htmlspecialchars(shell_exec('tools/doc_extract '.$field.' '.$module.'/_info.c'));
 }
 
    return htmlspecialchars(shell_exec('tools/doc_extract '.$field.' '.$module.'/_info.c'));
 }
 
-# Convert double line breaks into paragraphs, and blank spaces into preformat.
+// Convert double line breaks into paragraphs, and blank spaces into preformat.
 function htmlize_field($field,$module)
 {
    $state="inpara";
 function htmlize_field($field,$module)
 {
    $state="inpara";
diff --git a/web/uploader.php b/web/uploader.php
deleted file mode 100644 (file)
index 40e2944..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-session_start();
-include('logo.html');
-include('menulist.html');
-include('static-configuration');
-
-// We just email notification for now.  Auto-analysis RSN.
-if ($_FILES["uploadedfile"]["error"] > 0) {
-  echo "Error: " . $_FILES["uploadedfile"]["error"] . "<br />";
-  exit();
-}
-
-$dest = tempnam($tempfolder, "upload-");
-move_uploaded_file($_FILES["uploadedfile"]["tmp_name"], $dest);
-
-$subject = "CCAN: code upload by '" . $_POST['email'] . "' with name " . $_FILES["uploadedfile"]["name"];
-$message = "File type: ".$_FILES["uploadedfile"]["type"]."\n".
-       "Size: ".$_FILES["uploadedfile"]["size"]."\n".
-       "Claimed email: ".$_POST['email']."\n".
-       "File destination: ".$dest."\n";
-
-mail($ccanadmin, $subject, $message, "From: $frommail");
-echo "<div align=\"center\"> Thanks!<br>Stored to temporary location. 
-       Mail will be send to admin to get verification of the code.<//div>";
-?>
diff --git a/web/uploader.php.cpp b/web/uploader.php.cpp
new file mode 100644 (file)
index 0000000..ed7f76a
--- /dev/null
@@ -0,0 +1,27 @@
+<?php
+session_start();
+?>
+#include "logo.html"
+#include "menulist.html"
+#include "static-configuration"
+<?php
+
+// We just email notification for now.  Auto-analysis RSN.
+if ($_FILES["uploadedfile"]["error"] > 0) {
+  echo "Error: " . $_FILES["uploadedfile"]["error"] . "<br />";
+  exit();
+}
+
+$dest = tempnam($tempfolder, "upload-");
+move_uploaded_file($_FILES["uploadedfile"]["tmp_name"], $dest);
+
+$subject = "CCAN: code upload by '" . $_POST['email'] . "' with name " . $_FILES["uploadedfile"]["name"];
+$message = "File type: ".$_FILES["uploadedfile"]["type"]."\n".
+       "Size: ".$_FILES["uploadedfile"]["size"]."\n".
+       "Claimed email: ".$_POST['email']."\n".
+       "File destination: ".$dest."\n";
+
+mail($ccanadmin, $subject, $message, "From: $frommail");
+echo "<div align=\"center\"> Thanks!<br>
+       Mail will be send to admin to publish the code.<//div>";
+?>