From: Rusty Russell Date: Sun, 9 Nov 2008 21:49:51 +0000 (+1100) Subject: Upload now works, with a bit of hackery. X-Git-Url: http://git.ozlabs.org/?p=ccan;a=commitdiff_plain;h=963fa5ca9303d146d635e2fba04814f4f791c559;hp=ad8da11f6d0664e0fb3c8707a869425088daea7e Upload now works, with a bit of hackery. Also, fixed "Archieve" typo in header (Thanks Tim Connors) --- diff --git a/Makefile b/Makefile index e11ddc27..d3e05e9f 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ # 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. @@ -22,7 +22,7 @@ distclean: clean 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 $@ @@ -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 > $@ +# 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 > $@ diff --git a/web/logo.html b/web/logo.html index 61c8f7e7..9a15f28a 100644 --- a/web/logo.html +++ b/web/logo.html @@ -1,5 +1,4 @@ @@ -14,7 +13,7 @@ $url_prefix = getenv("URLPREFIX"); -

Comprehensive C Archieve Network

+

Comprehensive C Archive Network

diff --git a/web/menulist.html b/web/menulist.html index aa5993f5..bd15a08e 100644 --- a/web/menulist.html +++ b/web/menulist.html @@ -1,5 +1,4 @@ diff --git a/web/static-configuration b/web/static-configuration index 3ff84923..f0fcb89e 100644 --- a/web/static-configuration +++ b/web/static-configuration @@ -25,7 +25,7 @@ function extract_field($field,$module) 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"; diff --git a/web/uploader.php b/web/uploader.php deleted file mode 100644 index 40e29445..00000000 --- a/web/uploader.php +++ /dev/null @@ -1,25 +0,0 @@ - 0) { - echo "Error: " . $_FILES["uploadedfile"]["error"] . "
"; - 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 "
Thanks!
Stored to temporary location. - Mail will be send to admin to get verification of the code."; -?> diff --git a/web/uploader.php.cpp b/web/uploader.php.cpp new file mode 100644 index 00000000..ed7f76a6 --- /dev/null +++ b/web/uploader.php.cpp @@ -0,0 +1,27 @@ + +#include "logo.html" +#include "menulist.html" +#include "static-configuration" + 0) { + echo "Error: " . $_FILES["uploadedfile"]["error"] . "
"; + 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 "
Thanks!
+ Mail will be send to admin to publish the code."; +?>